Skip to content

basalt / storage/src / LocalStorageDriver

Class: LocalStorageDriver ​

Defined in: storage/src/drivers/local.ts:10

Filesystem driver — the default for local development and simple deployments.

Implements ​

Constructors ​

Constructor ​

> new LocalStorageDriver(options): LocalStorageDriver

Defined in: storage/src/drivers/local.ts:14

Parameters ​

options ​
root ​

string

Returns ​

LocalStorageDriver

Properties ​

name ​

> readonly name: "local" = 'local'

Defined in: storage/src/drivers/local.ts:11

Human-readable driver name — used in error messages.

Implementation of ​

StorageDriver.name

Methods ​

copy() ​

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

Defined in: storage/src/drivers/local.ts:59

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? ​

CopyDriverOptions

Returns ​

Promise<void>

Implementation of ​

StorageDriver.copy


delete() ​

> delete(path): Promise<boolean>

Defined in: storage/src/drivers/local.ts:82

Parameters ​

path ​

string

Returns ​

Promise<boolean>

Implementation of ​

StorageDriver.delete


disconnect() ​

> disconnect(): Promise<void>

Defined in: storage/src/drivers/local.ts:111

Returns ​

Promise<void>

Implementation of ​

StorageDriver.disconnect


exists() ​

> exists(path): Promise<boolean>

Defined in: storage/src/drivers/local.ts:73

Parameters ​

path ​

string

Returns ​

Promise<boolean>

Implementation of ​

StorageDriver.exists


get() ​

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

Defined in: storage/src/drivers/local.ts:40

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/src/drivers/local.ts:51

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>

Implementation of ​

StorageDriver.getStream


list() ​

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

Defined in: storage/src/drivers/local.ts:91

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/src/drivers/local.ts:18

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/src/drivers/local.ts:29

Writes the stream to disk. On failure — including the Disk layer's maxBytes abort — the partial file is removed, so a rejected upload never leaves a truncated object behind.

Parameters ​

path ​

string

source ​

Readable

_options ​

PutStreamOptions

Returns ​

Promise<void>

Implementation of ​

StorageDriver.putStream


stat() ​

> stat(path): Promise<StorageStat>

Defined in: storage/src/drivers/local.ts:68

The filesystem stores no content type or etag, so only size and mtime are reported.

Parameters ​

path ​

string

Returns ​

Promise<StorageStat>

Implementation of ​

StorageDriver.stat

Released under the MIT License.