Code Monkey home page Code Monkey logo

data-keeper's Introduction

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)

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
}

data-keeper's People

Contributors

coolgo0811 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.