Skip to content

A tiny module to store data in memory with a persistance layer using localStorage

License

Notifications You must be signed in to change notification settings

peermusic/in-memory-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Storage in memory

A tiny module to only read/write localStorage whenever neccessary, and else keeping data in memory. It also handles converting data so you can pass objects/arrays into it.

Install

npm install https://github.com/peermusic/in-memory-storage
var storage = require('in-memory-storage')

For reference see the Browserify Handbook.

Usage

var storage = require('in-memory-storage')

// Read a key from memory or localStorage, with an optional default
storage.get('key', {})

// Set a key in memory and localStorage
storage.set('key', {id: 1, name: 'Test'})

// Remove a key from memory and localStorage
storage.remove('key')

About

A tiny module to store data in memory with a persistance layer using localStorage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published