storage2

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i storage2

Weekly Downloads

9,879

Version

0.1.2

License

ISC

Unpacked Size

5.45 kB

Total Files

8

Last publish

Collaborators

  • adjusted