s3z
Node.js

Quick Start

Install

npm install @jae_aeich/s3z

Quick start

Create a client — credentials are read from environment variables by default:

import { S3Client } from "@jae_aeich/s3z";

const client = await S3Client.create({ region: "us-east-1" });

Upload files or directories. They're walked recursively and uploaded in parallel:

const uploaded = await client.upload({
  sources: ["./data"],
  bucket: "my-bucket",
  prefix: "uploads/",
});

for (const f of uploaded) {
  console.log(`${f.source} → s3://${f.key} (${f.parts} parts)`);
}

Download everything under a prefix to a local directory:

const downloaded = await client.download({
  bucket: "my-bucket",
  prefix: "uploads/",
  destDir: "./out",
});

List objects:

const objects = await client.list({
  bucket: "my-bucket",
  prefix: "uploads/",
});

for (const obj of objects) {
  console.log(`${obj.key} (${obj.size} bytes)`);
}

S3-compatible backends

Pass explicit credentials and a custom endpoint for MinIO, SeaweedFS, Garage, or any S3-compatible backend:

const client = await S3Client.create({
  region: "us-east-1",
  accessKey: "access-key",
  secretKey: "secret-key",
  endpoint: "http://localhost:9000",
});

On this page