0.1.2 • Published 3 years ago

storage2 v0.1.2

Weekly downloads
33,436
License
ISC
Repository
github
Last release
3 years ago

storage2

Build Status codecov.io

HTML5 storage interface for node and browser

  • node: simple memory storage
  • browser with storage api available: return global storage object directly (window.localStorage and window.sessionStorage)
  • browser without storage api: cookie fallback

Installation

npm install storage2 --save

Usage

var ls = require("storage2").localStorage;
var ss = require("storage2").sessionStorage;

For safari private mode, localStorage and sessionStorage will still be available globally but storage usage will cause an exception. localStorage = require('storage2').localStorage is not recommended and a different variable name like ls should always be used.

API

Web Storage API

License

ISC