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
Readablestream,fetchReadableStream,Buffer, andBlobcompatibility 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, andtoJSONhooks 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
| Module | Primary Class / Functions | Description |
|---|---|---|
| Client | BastionClient | Root client handle managing connections, user auth, and buckets. |
| Buckets | BucketHandle, BucketsClient | Bucket lifecycle, quotas, tags, and configuration. |
| Objects | BastionObject | Object streaming, range slicing, conversion helpers, and deletion. |
| Multipart | MultipartUploadHandle | Resumable chunked multipart upload session manager. |
| Identity | UsersClient, AccessKeysClient | User provisioning, password changes, and access key rotation. |
| Errors | BastionError | Typed error taxonomy for handling API and network failures. |