Reference — /s3
import { S3ObjectStore } from 'git-fs-s3/s3';Node.jsCloudflare WorkersDenoBrowser
class
S3ObjectStorenew S3ObjectStore(options: S3ObjectStoreOptions)| Parameter | Type | Description |
|---|---|---|
options.client | S3Client | A configured client — works with AWS S3, Cloudflare R2, MinIO, Backblaze B2. |
options.bucket | string | |
options.prefix? | string | Key prefix for every object. |
options.contentType? | (key: string) => string | undefined | Derives a Content-Type for uploads. Cosmetic only — git never reads it back. |
Implements ObjectStore (see the guide)
over any S3-compatible API.
import { S3Client } from '@aws-sdk/client-s3';import { S3ObjectStore } from 'git-fs-s3/s3';
const store = new S3ObjectStore({ client: new S3Client({ region: 'auto', endpoint: process.env.R2_ENDPOINT, // omit for AWS S3 credentials: { accessKeyId: process.env.R2_ACCESS_KEY_ID!, secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!, }, }), bucket: 'my-git-repos', contentType: (key) => /\/(HEAD|config)$|\/refs\//.test(key) ? 'text/plain' : undefined,});@aws-sdk/client-s3 is an optional peer dependency, loaded only when you
import this subpath — the root package and /http//ops never pull it in.