Skip to content
Files SDK
Esc
navigateopen⌘Jpreview
On this page

Storj

Storj DCS via the S3-compatible Gateway. Defaults to the hosted Gateway MT, path-style addressing on.

Installation

@aws-sdk/client-s3, @aws-sdk/s3-presigned-post, and @aws-sdk/s3-request-presigner are optional peer dependencies of files-sdk - install alongside the SDK so the adapter’s imports resolve at runtime.

npm install files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner
pnpm add files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner
yarn add files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner
bun add files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner

Usage

import { Files } from "files-sdk";
import { storj } from "files-sdk/storj";

const files = new Files({
  adapter: storj({
    bucket: "uploads",
    // endpoint defaults to https://gateway.storjshare.io (Gateway MT).
    // Pass a self-hosted Gateway ST URL to override.
    // accessKeyId / secretAccessKey auto-loaded from
    // STORJ_ACCESS_KEY_ID / STORJ_SECRET_ACCESS_KEY
  }),
});

Options

PropType
bucketstring

Storj bucket name. The adapter scopes all operations to it.

Typestring
endpoint?string

Storj S3 gateway URL. Defaults to `https://gateway.storjshare.io` (Gateway MT — Storj's hosted multi-tenant gateway). Override with a self-hosted Gateway ST URL if you run your own.

Typestring
accessKeyId?string

Static access key ID. Falls back to `STORJ_ACCESS_KEY_ID`; required if that env var isn't set. This is an S3-style gateway key, not your Storj access grant — the gateway translates it server-side.

Typestring
secretAccessKey?string

Static secret access key. Falls back to `STORJ_SECRET_ACCESS_KEY`; required if that env var isn't set.

Typestring
region?string

SigV4 region used for signing. Defaults to `us-east-1`. SigV4 requires some region in the signature; the Storj gateway ignores it for routing, so leave the default unless you have a reason to change it.

Typestring
forcePathStyle?boolean

Use path-style addressing (`/<bucket>/<key>`). Defaults to `true` for Storj — the gateway routes path-style. Flip off only if you've fronted the gateway with subdomain routing.

Typeboolean
publicBaseUrl?string

Origin used to build URLs from `url()`. When set, `url(key)` returns `${publicBaseUrl}/${key}` and skips signing. For Storj, the natural value is a linksharing prefix like `https://link.storjshare.io/raw/<accessGrant>/<bucket>` — generate one with `uplink share --url`. When unset, `url()` falls back to a presigned GetObject (default expiry: 1 hour).

Typestring
defaultUrlExpiresIn?number

Default expiry, in seconds, for the presigned URLs returned by `url()` when `publicBaseUrl` is not set. Defaults to 3600 (1 hour).

Typenumber

Compatibility

Method Status Notes
upload
download
delete
list
search
head
exists
copy
url
signedUploadUrl

Was this page helpful?