basalt / storage/src / StorageDriver
Interface: StorageDriver
Defined in: storage/src/driver.ts:58
Storage driver contract. Every driver must pass the same conformance suite.
Properties
name
> readonly name: string
Defined in: storage/src/driver.ts:60
Human-readable driver name — used in error messages.
Methods
copy()?
> optional copy(from, to, options?): Promise<void>
Defined in: storage/src/driver.ts:94
Optional: server-side copy inside this driver's own bucket/container — the bytes never travel through the process. Throws StorageFileNotFoundError when from does not exist.
Parameters
from
string
to
string
options?
Returns
Promise<void>
delete()
> delete(path): Promise<boolean>
Defined in: storage/src/driver.ts:65
Parameters
path
string
Returns
Promise<boolean>
disconnect()
> disconnect(): Promise<void>
Defined in: storage/src/driver.ts:114
Returns
Promise<void>
exists()
> exists(path): Promise<boolean>
Defined in: storage/src/driver.ts:64
Parameters
path
string
Returns
Promise<boolean>
get()
> get(path): Promise<Buffer<ArrayBufferLike>>
Defined in: storage/src/driver.ts:63
Throws StorageFileNotFoundError when the file does not exist.
Parameters
path
string
Returns
Promise<Buffer<ArrayBufferLike>>
getStream()?
> optional getStream(path): Promise<Readable>
Defined in: storage/src/driver.ts:88
Optional: reads an object as a stream. The caller MUST consume or destroy the returned readable. Throws StorageFileNotFoundError when the object does not exist.
Parameters
path
string
Returns
Promise<Readable>
list()
> list(prefix): Promise<string[]>
Defined in: storage/src/driver.ts:72
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[]>
put()
> put(path, content, options?): Promise<void>
Defined in: storage/src/driver.ts:61
Parameters
path
string
content
string | Buffer<ArrayBufferLike>
options?
Returns
Promise<void>
putStream()?
> optional putStream(path, source, options): Promise<void>
Defined in: storage/src/driver.ts:82
Optional: uploads a body without ever holding it whole in memory.
The Disk layer validates the key, applies the tenant scope, checks allowedContentTypes, and normalizes whatever the caller passed into ONE Node Readable that already enforces maxBytes — it errors mid-stream past the cap, which aborts the upload and destroys the original source. A driver therefore only has to consume the readable it is handed.
Parameters
path
string
source
Readable
options
Returns
Promise<void>
stat()?
> optional stat(path): Promise<StorageStat>
Defined in: storage/src/driver.ts:99
Optional: object metadata without downloading it. Throws StorageFileNotFoundError when the object does not exist.
Parameters
path
string
Returns
Promise<StorageStat>
temporaryUploadUrl()?
> optional temporaryUploadUrl(path, expiresInMs, options): Promise<TemporaryUploadUrl>
Defined in: storage/src/driver.ts:109
Optional: pre-signed direct-upload (PUT) URL valid for expiresInMs. The driver must bind contentType (and contentLength / checksumSha256 when given) into the signature where its backend supports it, and return every header the client has to send. The Disk layer validates the key, applies the tenant scope and caps the lifetime before calling this.
Parameters
path
string
expiresInMs
number
options
TemporaryUploadUrlDriverOptions
Returns
Promise<TemporaryUploadUrl>
temporaryUrl()?
> optional temporaryUrl(path, expiresInMs, options?): Promise<string>
Defined in: storage/src/driver.ts:101
Optional: pre-signed URL valid for expiresInMs.
Parameters
path
string
expiresInMs
number
options?
Returns
Promise<string>