Skip to main content

Node.js

There are two ways to use Tigris with Node.js:

  • Tigris SDK — a type-safe SDK for TypeScript and JavaScript with a simple, high-level API. This is the recommended approach.
  • AWS JavaScript SDK — use the standard AWS SDK for JavaScript v3, just point it at Tigris. Useful if you have existing AWS S3 code to migrate.

Both are fully S3-compatible. We recommend the Tigris SDK for new projects.

Prerequisites

Install

npm install @tigrisdata/storage

Configure credentials

Set your Tigris credentials as environment variables:

export TIGRIS_STORAGE_ACCESS_KEY_ID="tid_your_access_key"
export TIGRIS_STORAGE_SECRET_ACCESS_KEY="tsec_your_secret_key"
export TIGRIS_STORAGE_BUCKET="my-bucket"

Or add them to a .env file in your project root:

TIGRIS_STORAGE_ACCESS_KEY_ID=tid_your_access_key
TIGRIS_STORAGE_SECRET_ACCESS_KEY=tsec_your_secret_key
TIGRIS_STORAGE_BUCKET=my-bucket

Create a client

The Tigris SDK reads credentials from environment variables automatically — no client setup needed:

import { list, put, get } from "@tigrisdata/storage";

Basic operations

Upload an object

import { put } from "@tigrisdata/storage";

await put("hello.txt", "Hello, World!");

// Upload a file from disk
import { readFileSync } from "fs";
await put("data.csv", readFileSync("data.csv"));

Download an object

import { get } from "@tigrisdata/storage";

const data = await get("hello.txt");
console.log(data.toString());

List objects

import { list } from "@tigrisdata/storage";

const objects = await list();
console.log(objects);

Delete an object

import { del } from "@tigrisdata/storage";

await del("hello.txt");

Next steps

  • Example Next.js app — a Next.js app that uploads and manages files with the Tigris SDK, ready to deploy to Vercel
  • Tigris SDK reference — full SDK documentation including client uploads, multipart uploads, and more
  • AWS JS SDK reference — advanced usage with presigned URLs, metadata queries, and conditional operations