random-access-web-storage
v2.0.0
Published
Exposes the same interface as random-access-file but instead of writing/reading data to a file it writes to any Web Storage API compatible database
Downloads
7
Readme
random-access-web-storage
Exposes the same interface as random-access-file but instead of writing/reading data to a file it writes to any Web Storage API compatible database.
npm install random-access-web-storage
Usage
import RAWS from 'random-access-web-storage';
// Create random access web storage using a Web Storage instance
const raws = RAWS(localStorage);
var file = raws(filename);
file.write(0, Buffer.from('hello'), function () {
file.write(5, Buffer.from(' world'), function () {
file.read(0, 11, console.log); // returns Buffer(hello world)
});
});
License
MIT