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

3.0.0 • Public • Published

@varasto/memory-storage

npm

Implementation of an storage which stores values in memory instead of hard disk or remote server.

Because it provides full storage implementation without persistence, it's useful for writing test cases for libraries/applications that use Varasto storages for storing data.

Installation

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

Usage

The package provides a class called MemoryStorage which is an implementation of Storage type.

Basic usage of the API looks like this:

import { MemoryStorage } from '@varasto/memory-storage';

const storage = new MemoryStorage();

Memory storage instance also has an additional clear() method that will remove either all data from the storage, or items from specified namespace.

storage.clear(); // Removes all data from the storage.

storage.clear('foo'); // Removes all items from namespace "foo".

/@varasto/memory-storage/

    Package Sidebar

    Install

    npm i @varasto/memory-storage

    Weekly Downloads

    1

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    9.89 kB

    Total Files

    10

    Last publish

    Collaborators

    • rauli