Skip to content

basalt / storage-azure/src / AzureBlobStorageDriver

Class: AzureBlobStorageDriver ​

Defined in: storage-azure/src/index.ts:85

Azure Blob Storage driver for @basaltkit/storage. Uses @azure/storage-blob (an optional peer dependency) via an injectable container client, so its logic is unit-tested without touching Azure.

Implements ​

Constructors ​

Constructor ​

> new AzureBlobStorageDriver(options): AzureBlobStorageDriver

Defined in: storage-azure/src/index.ts:89

Parameters ​

options ​

AzureDriverOptions

Returns ​

AzureBlobStorageDriver

Properties ​

name ​

> readonly name: "azure" = 'azure'

Defined in: storage-azure/src/index.ts:86

Human-readable driver name — used in error messages.

Implementation of ​

StorageDriver.name

Methods ​

copy() ​

> copy(from, to, options?): Promise<void>

Defined in: storage-azure/src/index.ts:149

Server-side copy: the destination blob pulls the source through a short-lived read SAS, so the bytes never reach this process.

syncCopyFromURL (Copy Blob From URL) completes before it resolves and is limited to 256 MiB by Azure; copy larger blobs with beginCopyFromURL on the SDK client directly, or stream them with getStream/putStream.

Parameters ​

from ​

string

to ​

string

options? ​

CopyDriverOptions

Returns ​

Promise<void>

Implementation of ​

StorageDriver.copy


delete() ​

> delete(path): Promise<boolean>

Defined in: storage-azure/src/index.ts:190

Parameters ​

path ​

string

Returns ​

Promise<boolean>

Implementation of ​

StorageDriver.delete


disconnect() ​

> disconnect(): Promise<void>

Defined in: storage-azure/src/index.ts:260

Returns ​

Promise<void>

Implementation of ​

StorageDriver.disconnect


exists() ​

> exists(path): Promise<boolean>

Defined in: storage-azure/src/index.ts:186

Parameters ​

path ​

string

Returns ​

Promise<boolean>

Implementation of ​

StorageDriver.exists


get() ​

> get(path): Promise<Buffer<ArrayBufferLike>>

Defined in: storage-azure/src/index.ts:115

Throws StorageFileNotFoundError when the file does not exist.

Parameters ​

path ​

string

Returns ​

Promise<Buffer<ArrayBufferLike>>

Implementation of ​

StorageDriver.get


getStream() ​

> getStream(path): Promise<Readable>

Defined in: storage-azure/src/index.ts:125

download() — the blob's body as a Node readable. The caller must consume or destroy it.

Parameters ​

path ​

string

Returns ​

Promise<Readable>

Implementation of ​

StorageDriver.getStream


list() ​

> list(prefix): Promise<string[]>

Defined in: storage-azure/src/index.ts:195

Lists full object keys starting with prefix (the Disk layer passes the tenant scope in it). A plain string-prefix match is fine: the Disk narrows the result to directory semantics and strips the scope before callers see it.

Parameters ​

prefix ​

string

Returns ​

Promise<string[]>

Implementation of ​

StorageDriver.list


put() ​

> put(path, content, options?): Promise<void>

Defined in: storage-azure/src/index.ts:91

Parameters ​

path ​

string

content ​

string | Buffer<ArrayBufferLike>

options? ​

PutOptions

Returns ​

Promise<void>

Implementation of ​

StorageDriver.put


putStream() ​

> putStream(path, source, options): Promise<void>

Defined in: storage-azure/src/index.ts:102

uploadStream — the SDK splits the readable into blocks, so a body of any size (and of unknown length) is uploaded without ever being held whole.

Parameters ​

path ​

string

source ​

Readable

options ​

PutStreamOptions

Returns ​

Promise<void>

Implementation of ​

StorageDriver.putStream


stat() ​

> stat(path): Promise<StorageStat>

Defined in: storage-azure/src/index.ts:167

getProperties() — size, content type, etag and last-modified without a download.

Parameters ​

path ​

string

Returns ​

Promise<StorageStat>

Implementation of ​

StorageDriver.stat


temporaryUploadUrl() ​

> temporaryUploadUrl(path, expiresInMs, options): Promise<TemporaryUploadUrl>

Defined in: storage-azure/src/index.ts:229

Pre-signed direct upload: a service SAS with create + write permission only (no read/list/delete), valid for expiresInMs.

Caveat: an Azure SAS cannot bind request headers, so — unlike S3 and GCS — the declared Content-Type and Content-Length are NOT enforced by the signature. They are returned as the headers the client should send; treat the upload as untrusted and verify the blob's properties (type, size) before using it. checksumSha256 is refused: Put Blob has no SHA-256 header to carry it.

Parameters ​

path ​

string

expiresInMs ​

number

options ​

TemporaryUploadUrlDriverOptions

Returns ​

Promise<TemporaryUploadUrl>

Implementation of ​

StorageDriver.temporaryUploadUrl


temporaryUrl() ​

> temporaryUrl(path, expiresInMs, options?): Promise<string>

Defined in: storage-azure/src/index.ts:201

Optional: pre-signed URL valid for expiresInMs.

Parameters ​

path ​

string

expiresInMs ​

number

options? ​

TemporaryUrlOptions

Returns ​

Promise<string>

Implementation of ​

StorageDriver.temporaryUrl

Released under the MIT License.