0.1.0 • Published 1 year ago

@n7e/storage-memory v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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();
0.1.0

1 year ago