Minima.js API / @minimajs/azure-blob / AzureBlobDriver
Class: AzureBlobDriver
Azure Blob Storage driver for @minimajs/disk
Provides a web-native File API interface for Azure Blob Storage, eliminating the need to learn Azure SDK methods.
Example
import { AzureBlobDriver } from '@minimajs/azure-blob';
import { createDisk } from '@minimajs/disk';
const driver = new AzureBlobDriver({
connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING!,
container: 'uploads',
publicUrl: 'https://mycdn.azureedge.net',
});
const disk = createDisk({ driver });
// Web-native API - works like browser File API
const file = new File(['content'], 'test.txt');
await disk.put(file); // Auto-generates filename
await disk.put('docs/readme.md', 'Hello Azure');
const retrieved = await disk.get('docs/readme.md');
const text = await retrieved.text(); // Standard File.text()Implements
Constructors
Constructor
new AzureBlobDriver(client, options): AzureBlobDriver;Parameters
client
BlobServiceClient
options
Returns
AzureBlobDriver
Properties
[toStringTag]
[toStringTag]: string = "AzureBlobDriver";capabilities
readonly capabilities: DriverCapabilities;Optional capability declarations — see DriverCapabilities
Implementation of
client
readonly client: BlobServiceClient;name
readonly name: "azure-blob" = "azure-blob";Driver name (e.g., 'fs', 's3', 'azure')
Implementation of
Methods
[custom]()
custom: {
[toStringTag]: string;
account: string;
container: string | undefined;
publicUrl: string | undefined;
};Returns
{
[toStringTag]: string;
account: string;
container: string | undefined;
publicUrl: string | undefined;
}[toStringTag]
[toStringTag]: string;account
account: string;container
container: string | undefined;publicUrl
publicUrl: string | undefined;copy()
copy(from, to): Promise<void>;Copy a file to a new location
Parameters
from
string
Source absolute URL/URI
to
string
Destination absolute URL/URI
Returns
Promise<void>
Implementation of
delete()
delete(href): Promise<void>;Delete file by href
Parameters
href
string
Absolute URL/URI with protocol
Returns
Promise<void>
Implementation of
exists()
exists(href): Promise<boolean>;Check if file exists
Parameters
href
string
Absolute URL/URI with protocol
Returns
Promise<boolean>
Implementation of
get()
get(href): Promise<
| [ReadableStream<Uint8Array<ArrayBufferLike>>, FileMetadata]
| null>;Retrieve file as a ReadableStream with metadata
Parameters
href
string
Absolute URL/URI with protocol
Returns
Promise< | [ReadableStream<Uint8Array<ArrayBufferLike>>, FileMetadata] | null>
Tuple of [stream, metadata] or null if not found
Implementation of
list()
list(prefixHref, listOptions?): AsyncIterable<FileMetadata>;List files under a prefix href.
Parameters
prefixHref
string
Absolute href prefix ending with /, or "" to list everything.
listOptions?
Pagination options
Returns
AsyncIterable<FileMetadata>
Implementation of
metadata()
metadata(href): Promise<
| FileMetadata
| null>;Get file metadata without content
Parameters
href
string
Absolute URL/URI with protocol
Returns
Promise< | FileMetadata | null>
Implementation of
move()
move(from, to): Promise<void>;Move a file to a new location
Parameters
from
string
Source absolute URL/URI
to
string
Destination absolute URL/URI
Returns
Promise<void>
Implementation of
put()
put(
href,
stream,
putOptions): Promise<FileMetadata>;Store data from a ReadableStream
Parameters
href
string
Absolute URL/URI with protocol
stream
ReadableStream<Uint8Array<ArrayBufferLike>>
ReadableStream of data to store
putOptions
Optional metadata and content type
Returns
Promise<FileMetadata>
FileMetadata about the stored file
Implementation of
updateMetadata()
updateMetadata(href, updates): Promise<FileMetadata>;Parameters
href
string
updates
metadata?
Record<string, string>
type?
string
Returns
Promise<FileMetadata>
url()
url(href): Promise<string>;Generate a URL for the file
Parameters
href
string
Absolute URL/URI with protocol
Returns
Promise<string>