Archil

Archil disks via the S3-compatible API. The disk id is the bucket and the endpoint is derived from the Archil region. Supports branch-scoped access.

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. The disk package is also optional - install it only if you pass a Disk instance to reach Archil-native operations.

npm install files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner

Usage

import { Files } from "files-sdk";
import { archil } from "files-sdk/archil";

const files = new Files({
  adapter: archil({
    bucket: "dsk-0123456789abcdef", // your Archil disk id
    region: "aws-us-east-1",
    // accessKeyId / secretAccessKey auto-loaded from
    // ARCHIL_S3_ACCESS_KEY_ID / ARCHIL_S3_SECRET_ACCESS_KEY
  }),
});

Archil disks via their S3-compatible API. A thin wrapper around the S3 adapter - the disk id is the path-style bucket, the endpoint is derived from the Archil region (aws-us-east-1, gcp-us-central1, ...), and SigV4 signs every request, so byte ranges, multipart uploads, and presigned url() / signedUploadUrl() all work. Auto-loads ARCHIL_S3_ACCESS_KEY_ID, ARCHIL_S3_SECRET_ACCESS_KEY, and ARCHIL_REGION.

Branches

Set branch to scope the whole unified surface to a branch of the disk - upload, download, list, and presigned URLs all read and write that branch:

const preview = new Files({
  adapter: archil({
    branch: "preview",
    bucket: "dsk-0123456789abcdef",
    region: "aws-us-east-1",
  }),
});

Archil-native operations

The unified surface covers object storage. For Archil-native operations that aren't object storage - exec, grep, appendObject, share - pass a Disk instance (from the disk package); it's exposed at files.adapter.disk, and bucket / region are inferred from it:

import { getDisk } from "disk";

const disk = await getDisk("dsk-0123456789abcdef");
const files = new Files({ adapter: archil({ disk }) });

await files.upload("src/app.ts", code); // unified surface
await files.adapter.disk?.exec("tsc --noEmit"); // Archil-native

Options

Prop

Type

Compatibility

MethodStatusNotes
upload
download
delete
list
search
head
exists
copy
urlSigV4 presigned, or publicBaseUrl when set.
signedUploadUrl

On this page