npm.io
1.0.9 • Published 5 years ago

local-json-store

Licence
ISC
Version
1.0.9
Deps
1
Size
20 kB
Vulns
0
Weekly
0

local-json-store

Installation

npm install local-json-store

Usage

const JSONStorage = require('./index').JSONStorage;
const js = new JSONStorage('./test');
js.setItem('testKey', {'aaa': 'bbb'});
console.log(js.getItem('testKey')['aaa']);

Fully implements the localStorage specfication including:

  • All methods
    • length
    • setItem(key, value)
    • getItem(key)
    • removeItem(key)
    • key(n)
    • clear()
  • Serializes to disk in the location specified during instantiation
  • Associative array jsonStorage['myKey'] = 'myValue' and dot property jsonStorage.myKey = 'myValue'