1.0.5 • Published 2 years ago
@revanode/reva-nls v1.0.5
reva-nls
nls === Node Local Storage
Docs
localStorage usage example:
const localStorage = require('@revanode/reva-nls');
localStorage.configure({
localStorageSavePath: './my-local-storage.json',
}); // if you dont configure save path, it defaults to ./localStorage.json
localStorage.init(); // setItem, getItem, removeItem, and clearItem will not be available if you don't run this
localStorage.setItem('hello', 'world');
console.log(localStorage.getItem('hello')); // world
console.log(localStorage.getItem('nonexistent')); // null
And unlike the browser's actual localStorage API, it supports other types as the value to be set!