data-keeper is a utility node-module for keep temporary data (json object) in files. The data will be compressed for disk space saving.
npm install data-keeper
const DataKeeper = require('data-keeper');
let dataKeeper = new DataKeeper();
Set the file path of the storage.
let basePath = path.join(__dirname, '/resume');
dataKeeper.init(basePath);
Write a data record to file.
let data = { t1: 1, t3: 3, ts: new Date() };
dataKeeper.write(data);
Get a few of data records from files. The input is the count of data that you want. If no input, the default count is 100.
let records = keeper.read(100);
Check if any data records exist or not.
For example:
while (keeper.dataAvailable()) { // check any records exist or not
let records = keeper.read(100); // get 100 records back
}