https://github.com/swiftcarrot/storage2
html5 storage interface for node and browser
https://github.com/swiftcarrot/storage2
Last synced: 11 days ago
JSON representation
html5 storage interface for node and browser
- Host: GitHub
- URL: https://github.com/swiftcarrot/storage2
- Owner: swiftcarrot
- License: isc
- Created: 2015-06-23T08:30:57.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-04-16T15:17:58.000Z (about 2 years ago)
- Last Synced: 2025-04-21T22:48:15.535Z (12 days ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/storage2
- Size: 31.3 KB
- Stars: 2
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# storage2
[](https://travis-ci.org/swiftcarrot/storage2) [](http://codecov.io/github/swiftcarrot/storage2?branch=master)
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
```sh
npm install storage2 --save
```### Usage
```javascript
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](https://developer.mozilla.org/en-US/docs/Web/API/Storage)
### License
ISC