1.1.7 • Published 6 years ago

data-keeper v1.1.7

Weekly downloads
6
License
ISC
Repository
github
Last release
6 years ago

data-keeper

data-keeper is a utility node-module for keep temporary data (json object) in files. The data will be compressed for disk space saving.

Installation

npm install data-keeper

Example

const DataKeeper = require('data-keeper');
let dataKeeper = new DataKeeper();

API

  • init(string)
  • write(object)
  • read([int])
  • dataAvailable()

#init(string)

Set the file path of the storage.

let basePath = path.join(__dirname, '/resume');
dataKeeper.init(basePath);

#write()

Write a data record to file.

let data = { t1: 1, t3: 3, ts: new Date() };
dataKeeper.write(data);

#read(int)

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);

#dataAvailable()

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
}

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago