Skip to content
s3nd
Menu

Examples

Runnable, in the repository.

Two examples you can clone and run, and the worked guides in the documentation. Both examples point at a local MinIO by default, so the real code path runs on your laptop with nothing to sign up for.

a bucket on your laptop
docker run -p 9000:9000 -p 9001:9001 \
  -e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin \
  quay.io/minio/minio server /data --console-address ":9001"

01examples/indexeddb-sync

IndexedDB sync

A notes app that keeps everything in IndexedDB and moves it to another device with a code. Open it in two browsers: the second one is empty until the code carries the database across.

Worth noticing

  • A complete exportDatabase / importDatabase pair against a real object store
  • The code shown grouped in fours, and normalized on the server with or without the spaces
  • Nothing imported before the user confirms what they are about to restore
  • ifAbsent on write, a one-hour expiry, and the DELETE after a successful import
  • A single transaction on import, so a failure halfway leaves the previous data intact
Next.jsIndexedDBs3ndMinIO
run it
cp .env.example .env.local
bun install
bun run dev   # localhost:3200, in two different browsers

02examples/node-script

Node round trip

A whole transfer in one file: write a snapshot under a code, read it back through a sloppily typed version of that code, prove the conditional writes work, then burn it. A smoke test for a new bucket or provider.

Worth noticing

  • The compression ratio on a realistic dump, printed as the headline
  • A code typed in lowercase with a dash, resolved by codes.normalize()
  • ifAbsent rejecting a second claim, ifMatch rejecting a stale write
  • destroy() in a finally, so the script exits without waiting on keep-alive sockets
NodeTypeScripts3nd
run it
cp .env.example .env
bun install
node --env-file=.env --import tsx src/round-trip.ts
expected output
code      ZZWMBSTD
stored    1826 bytes gzipped, from 22991 raw (12.6x)
typed     "zzwm-bstd" → ZZWMBSTD
restored  200 notes from node-script, written 2026-08-27T14:29:20.442Z
identical true
claim     rejected as PRECONDITION_FAILED
ifMatch   rejected as PRECONDITION_FAILED
burned    gone

Try it in a minute

No clone required.

  1. 01

    Start MinIO with the command above and create a bucket.

  2. 02

    Write a starter configuration and check it.

    npx @s3nd/cli init --provider minio --bucket transfersnpx @s3nd/cli doctor
  3. 03

    Move a file, and get it back with a sloppily typed code.

    npx @s3nd/cli put ./anything.pdfnpx @s3nd/cli get k7qp-2m4x

Put a file. Hand over the code.

Point it at the bucket you already pay for. Nothing to deploy, nothing to sign up for, nothing in the middle.

npm install -g @s3nd/clis3nd init --provider r2 --bucket drops3nd put ./anything.zip