Skip to content

swiftcarrot/storage2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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