HTML5 storage interface for node and browser
node
: simple memory storagebrowser with storage api available
: return global storage object directly (window.localStorage
andwindow.sessionStorage
)browser without storage api
: cookie fallback
npm install storage2 --save
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.
ISC