MinIO
MinIO and other self-hosted S3-compatible servers. Path-style addressing on by default; region defaulted; errors relabelled.
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 { minio } from "files-sdk/minio";
const files = new Files({
adapter: minio({
bucket: "uploads",
endpoint: "http://localhost:9000",
// accessKeyId / secretAccessKey auto-loaded from
// MINIO_ACCESS_KEY_ID / MINIO_SECRET_ACCESS_KEY
}),
});
Options
bucketstring
MinIO bucket name. The adapter scopes all operations to it.
stringendpointstring
MinIO server URL, e.g. `http://localhost:9000`. Include the scheme — `http://` for local dev, `https://` in production.
stringaccessKeyId?string
Static credentials. Falls back to `MINIO_ACCESS_KEY_ID`; required if that env var isn't set.
stringsecretAccessKey?string
Static credentials. Falls back to `MINIO_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, but MinIO ignores it for routing — leave the default unless you've configured per-region buckets.
stringforcePathStyle?boolean
Use path-style addressing (`/<bucket>/<key>`) rather than virtual-hosted style. Defaults to `true` for MinIO; flip off only if you've set up per-bucket subdomain routing in front of your server.
booleanpublicBaseUrl?string
Origin used to build URLs from `url()`. When set, `url(key)` returns `${publicBaseUrl}/${key}` — appropriate for a public bucket policy or a reverse proxy in front of MinIO. 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 |
✅ |