@n7e/storage-memory
v0.1.0
Published
An in-memory storage implementation.
Downloads
3
Readme
Memory Storage
An in-memory storage implementation.
For further insights, read on.
Installation
To install this library use your favorite package manager. No additional steps are required to start using the library.
npm install @n7e/storage-memory
This library is implemented in TypeScript but can be used with JavaScript without any additional steps.
Usage
To create an in-memory storage client use the provided StorageClientBuilder
implementation:
import { MemoryStorageClientBuilder } from "@n7e/storage-memory";
const storageClientBuilder = new MemoryStorageClientBuilder();
The builder allows us to configure existing entries:
storageClientBuilder.withExistingEntries([
{
type: EntryType.FILE,
location: new URL("file://some-file.txt"),
content: new TextEncoder().encode("some content")
}
]);
When configured, build a storage client instance:
const storageClient = storageClientBuilder.build();