@varasto/multi-storage
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

@varasto/multi-storage

npm

Storage implementation which retrieves and stores data to multiple other storage instances.

Installation

$ npm install --save @varasto/multi-storage

Usage

The package provides an function called createMultiStorage which takes multiple other storage instances as arguments. Data is retrieved from and stored to storages given as arguments.

import { createMemoryStorage } from '@varasto/memory-storage';
import { createMultiStorage } from '@varasto/multi-storage';

const storage1 = createMemoryStorage();
const storage2 = createMemoryStorage();

const multiStorage = createMultiStorage(storage1, storage2);

// This will insert the entry to both `storage1` and `storage2`.
await multiStorage.set('foo', 'bar', { value: 5 });

Readme

Keywords

Package Sidebar

Install

npm i @varasto/multi-storage

Weekly Downloads

2

Version

3.0.0

License

MIT

Unpacked Size

11.5 kB

Total Files

8

Last publish

Collaborators

  • rauli