storage2
HTML5 storage interface for node and browser
-
node
: simple memory storage -
browser with storage api available
: return global storage object directly (window.localStorage
andwindow.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
License
ISC