iDrive e2
iDrive e2 via the S3-compatible API. Endpoint required (iDrive hostnames are tied to the cluster your bucket lives in).
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 { idriveE2 } from "files-sdk/idrive-e2";
const files = new Files({
adapter: idriveE2({
bucket: "uploads",
endpoint: "https://q9z7.va.idrivee2-NN.com",
// accessKeyId / secretAccessKey auto-loaded from
// IDRIVE_E2_ACCESS_KEY_ID / IDRIVE_E2_SECRET_ACCESS_KEY
}),
});
iDrive e2 via its S3-compatible API. A thin wrapper around the S3 adapter with iDrive-friendly defaults - endpoint is required (iDrive e2 hostnames are tied to the cluster your bucket lives in and don’t follow a public pattern; copy it from the iDrive e2 dashboard), region defaulted, errors relabelled. Auto-loads from IDRIVE_E2_ACCESS_KEY_ID and IDRIVE_E2_SECRET_ACCESS_KEY. Generate access keys in the iDrive e2 dashboard under Access Keys.
Options
bucketstring
iDrive e2 bucket name. The adapter scopes all operations to it.
stringendpointstring
iDrive e2 endpoint URL. Required — iDrive e2 hostnames are tied to the storage region/cluster your bucket was provisioned in and don't follow a public pattern; copy the endpoint from the iDrive e2 dashboard (Access Keys → Endpoint). Example: `https://q9z7.va.idrivee2-NN.com`.
stringaccessKeyId?string
Static credentials. Falls back to `IDRIVE_E2_ACCESS_KEY_ID`; required if that env var isn't set.
stringsecretAccessKey?string
Static credentials. Falls back to `IDRIVE_E2_SECRET_ACCESS_KEY`; required if that env var isn't set.
stringregion?string
SigV4 region. Defaults to `"us-east-1"`. iDrive e2 ignores it for routing (the endpoint host carries the region info), but the SigV4 signature still needs *some* value.
stringforcePathStyle?boolean
Use path-style addressing (`/<bucket>/<key>`) rather than virtual-hosted style. Defaults to `false` — iDrive e2 supports virtual-hosted style on the bucket subdomain.
booleanpublicBaseUrl?string
Origin used to build URLs from `url()`. When set, `url(key)` returns `${publicBaseUrl}/${key}` and skips signing. iDrive e2 has no built-in CDN, so this is typically a custom CNAME or reverse proxy fronting the bucket. 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 |
✅ |