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

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-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 { 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

PropType
bucketstring

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

Typestring
endpointstring

MinIO server URL, e.g. `http://localhost:9000`. Include the scheme — `http://` for local dev, `https://` in production.

Typestring
accessKeyId?string

Static credentials. Falls back to `MINIO_ACCESS_KEY_ID`; required if that env var isn't set.

Typestring
secretAccessKey?string

Static credentials. Falls back to `MINIO_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, but MinIO ignores it for routing — leave the default unless you've configured per-region buckets.

Typestring
forcePathStyle?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.

Typeboolean
publicBaseUrl?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).

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?