@xylabs/storage

Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Install
Using npm:
npm install {{name}}
Using yarn:
yarn add {{name}}
Using pnpm:
pnpm add {{name}}
Using bun:
bun add {{name}}
License
See the LICENSE file for license rights and limitations (LGPL-3.0-only).
Reference
packages
storage
### .temp-typedoc
### interfaces
### <a id="KeyValueStore"></a>KeyValueStore
@xylabs/storage
A read/write storage device.
Extends
Type Parameters
TValue
TValue
TKey
TKey = string
Methods
get()
get(key): Promisable<TValue | undefined>;
Returns a promise that resolves to the value for the given key.
Parameters
key
TKey
The key to get the value for.
Returns
Promisable<TValue | undefined>
Inherited from
ReadonlyKeyValueStore.get
keys()?
optional keys(): Promisable<TKey[]>;
The keys an array of keys.
Returns
Promisable<TKey[]>
Inherited from
ReadonlyKeyValueStore.keys
clear()?
optional clear(): Promisable<void>;
Removes all entries from the store.
Returns
Promisable<void>
delete()
delete(key): Promisable<void>;
Deletes the entry with the given key.
Parameters
key
TKey
The key of the entry to delete
Returns
Promisable<void>
set()
set(key, value): Promisable<void>;
Sets a value for the given key, creating or updating the entry.
Parameters
key
TKey
The key to set
value
TValue
The value to store
Returns
Promisable<void>
### <a id="ReadonlyKeyValueStore"></a>ReadonlyKeyValueStore
@xylabs/storage
A readonly storage device.
Extended by
Type Parameters
TValue
TValue
TKey
TKey = string
Methods
get()
get(key): Promisable<TValue | undefined>;
Returns a promise that resolves to the value for the given key.
Parameters
key
TKey
The key to get the value for.
Returns
Promisable<TValue | undefined>
keys()?
optional keys(): Promisable<TKey[]>;
The keys an array of keys.
Returns
Promisable<TKey[]>