AzureBlob - TundraSoft/tundra-connect GitHub Wiki
Azure Blob Storage
Typed Azure Blob Storage REST API
client for Deno, Bun, Node.js and Cloudflare Workers, with Shared Key or SAS
authentication. Upload, download, list, inspect and delete blobs, including
streamed block uploads and downloads for large files. A lightweight,
Web-API-only alternative to @azure/storage-blob for the operations it covers.
Overview
AzureBlob exposes the repo's canonical object-storage surface —
putObject, getObject, deleteObject, listObjects, headObject — on
top of Azure's classic Blob endpoint
(https://{account}.blob.core.windows.net). Every request is authenticated
with Shared Key HMAC-SHA256 signing (or a pass-through pre-generated SAS
token), computed purely with Web Crypto (crypto.subtle) so the connect
runs unmodified on Deno, Bun, Node, Cloudflare Workers, and in the browser.
It uses RESTler for transport and Guardian for runtime response validation.
Testing your code
Your tests don't need to fake HTTP. Have your code take an AzureBlob instance
and pass in a stand-in that returns the shapes from
@tundraconnect/azure-blob/schemas or throws a real AzureBlobError:
import { AzureBlobError } from '@tundraconnect/azure-blob/errors';
const outage = new AzureBlobError('SERVER_BUSY', { status: 503 });
console.log(outage.code);
To exercise the client itself against a fake transport, subclass it and
reassign the protected _fetch.
Documentation
| Topic | Description |
|---|---|
| API | Client configuration and endpoint methods |
| Errors | Error codes and diagnostic metadata |
| Schemas | Public Guardian schemas and inferred types |
Upstream
Installation
Deno:
deno add jsr:@tundraconnect/azure-blob
Bun:
bunx jsr add @tundraconnect/azure-blob
Node.js:
npx jsr add @tundraconnect/azure-blob
Quick Start
import { AzureBlob } from '@tundraconnect/azure-blob';
const client = new AzureBlob({
auth: {
type: 'CUSTOM',
account: 'myaccount',
accountKey: 'base64-shared-key',
},
});
await client.putObject({
bucket: 'my-container',
key: 'hello.txt',
body: 'hello world',
contentType: 'text/plain',
});
const { body } = await client.getObject({
bucket: 'my-container',
key: 'hello.txt',
});
console.log(await body.text());
Large files
import { AzureBlob } from '@tundraconnect/azure-blob';
const client = new AzureBlob({
auth: { type: 'CUSTOM', account: 'myaccount', accountKey: '...' },
});
// Upload from a stream — one 4 MiB block in memory at a time.
const file = await Deno.open('backup.tar');
await client.putObjectStream({
bucket: 'backups',
key: 'backup.tar',
body: file.readable,
});
// Download as a stream — nothing buffered.
const { body } = await client.getObjectStream({
bucket: 'backups',
key: 'backup.tar',
});
await body.pipeTo((await Deno.create('restored.tar')).writable);
See API → Streaming.
License
MIT. Part of Tundra Connect, typed vendor API clients for Deno, Bun, Node.js and Cloudflare Workers.