0.2.4 • Published 10 years ago

jsoner v0.2.4

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
10 years ago

jsoner

Build Status Coverage Status

Simple, fast, minimalist JSON library for node

Installation

$ npm install jsoner

Features

  • stream parsing so you can read unlimited amounts of JSON data without ever having to hold the totality of the data in memory.
  • append to a JSON file on disk without having to ever read the whole object into memory.

Examples

Reading JSON objects from a large JSON file

var jsoner = require('jsoner');

var stream = fs.createReadStream('really_big.json');
jsoner.parse(stream)
.on('object', function(object) {
    console.log(JSON.stringify(object));
})
.on('error', function(err) {
    // do something with the error
}
.on('end', function() {

};

Appending multiple JSON objects to a JSON Array on disk

var jsoner = require('jsoner');

jsoner.appendFile('users.json', {
    firstName: "John",
    lastName:"Doe"
})
.then(function() {
    console.log('all done');
})
.catch(function(err) {
    console.error('there was an issue', err); 
});

jsoner.appendFileSync('users.json', {
    firstName: "Jane",
    lastName:"Doe"
})
.then(function() {
    console.log('all done');
})
.catch(function(err) {
    console.error('there was an issue', err); 
});

Development

To contribute feel free to open any issues or pull request. When developing locally make sure to run the built-in tests like so:

gulp test

In travis we run the following gulp tasks to make sure the current code is ready to be shipped:

gulp lint coverage

That runs the lint checks and then follows up with the same tests executed during gulp test but with the additional verification that 100% of the code is covered during testing and no untested code is introduced.

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago