Skip to main content

TypeScript & JavaScript Driver

The official driver package for Lioran S3 is @liorans3/driver. It provides a strongly-typed, high-performance client interface designed for modern Node.js, Bun, and TypeScript applications.

npm install @liorans3/driver

Key Capabilities​

  • Zero-Copy Streaming: Direct Node.js Readable stream, fetch ReadableStream, Buffer, and Blob compatibility without memory buffering.
  • Resumable Multipart Uploads: High-level automated chunking with concurrency controls, exponential backoff retries, and progress callbacks.
  • Cursor Pagination: Transparent iterator and batch pagination helpers for large buckets.
  • Expiring Presigned URLs: Client-side URL construction and signing for authorized browser downloads/uploads.
  • Typed Error Hierarchy: Dedicated error classes (NotFoundError, QuotaExceededError, BastionAuthError, StorageCapacityExhaustedError) mapped to API error codes.
  • Zero-Leak Masking: Built-in safeUri, util.inspect, and toJSON hooks to prevent accidental credential leakage in logs or crash dumps.

Quick Example​

import { BastionClient } from "@liorans3/driver";
import * as fs from "node:fs";

// 1. Connect using Bastion URI or options
const client = new BastionClient("bastion://admin:YOUR_PASSWORD@127.0.0.1:27118");

// 2. Select bucket
const bucket = client.bucket("backups");

// 3. Upload a file stream
const stream = fs.createReadStream("./archive.tar.gz");
const upload = await bucket.put("2026/db.tar.gz", stream, {
contentType: "application/gzip",
});
console.log(`Uploaded ${upload.key} (ETag: ${upload.etag})`);

// 4. Download directly to disk
const object = await bucket.get("2026/db.tar.gz");
await object.writeToFile("./restored.tar.gz");

Driver Modules​

ModulePrimary Class / FunctionsDescription
ClientBastionClientRoot client handle managing connections, user auth, and buckets.
BucketsBucketHandle, BucketsClientBucket lifecycle, quotas, tags, and configuration.
ObjectsBastionObjectObject streaming, range slicing, conversion helpers, and deletion.
MultipartMultipartUploadHandleResumable chunked multipart upload session manager.
IdentityUsersClient, AccessKeysClientUser provisioning, password changes, and access key rotation.
ErrorsBastionErrorTyped error taxonomy for handling API and network failures.

Next Steps​