Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

localstorage-memory

1.0.3 • Public • Published

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

Install

npm i localstorage-memory

DownloadsWeekly Downloads

8,738

Version

1.0.3

License

MIT

Unpacked Size

51.4 kB

Total Files

10

Last publish

Collaborators

  • avatar