localStorage-compatible API, but only stored in memory
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
lib
tests
vendor
.gitignore
.jshintrc
.npmignore
.travis.yml
README.md
bower.json
package-lock.json
package.json

README.md

localstorage-memory

localStorage-compatible API, but only stored in memory

Build Status

localStorageMemory provides all methods that localStorage in browsers provides, but no data is persisted, it's only stored in memory. It can be used as a drop-in replacement, the only exception being the Associative array syntax localStorage['myKey'] = 'myValue'.

Download or Installation

  • Download localstorage-memory.js
  • or: install via Bower: bower install --save localstorage-memory
  • or: install via npm: npm install --save localstorage-memory

Usage

localStorageMemory.getItem('unknown') // null
localStorageMemory.setItem('foo', 123)
localStorageMemory.getItem('foo') // "123"
localStorageMemory.length // 1
localStorageMemory.key(0) // "foo"
localStorageMemory.clear()
localStorageMemory.length // 0

Related

License

MIT