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-presignerpnpm add files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigneryarn add files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presignerbun add files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presignerUsage
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
bucketstring
Storj bucket name. The adapter scopes all operations to it.
stringendpoint?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.
stringaccessKeyId?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.
stringsecretAccessKey?string
Static secret access key. Falls back to `STORJ_SECRET_ACCESS_KEY`; required if that env var isn't set.
stringregion?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.
stringforcePathStyle?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.
booleanpublicBaseUrl?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).
stringdefaultUrlExpiresIn?number
Default expiry, in seconds, for the presigned URLs returned by `url()` when `publicBaseUrl` is not set. Defaults to 3600 (1 hour).
numberCompatibility
| Method | Status | Notes |
|---|---|---|
upload |
✅ | |
download |
✅ | |
delete |
✅ | |
list |
✅ | |
search |
✅ | |
head |
✅ | |
exists |
✅ | |
copy |
✅ | |
url |
✅ | |
signedUploadUrl |
✅ |