Skip to content

Output JavaScript objects from a JSON string input. And do the same the other way.

License

Notifications You must be signed in to change notification settings

alltherooms/json-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#json-stream

This is a tool to efficiently parse and send JSON data over the network.

#Usage

##Output JSON string chunks from JavaScript objects.

var Stringifier = require("json-stream").Stringifier;

http.createServer(function (req, res) {
  var stringifier = new Stringifier();
  stringifier.pipe(res);
  stringifier.end({a: 1, b: 2});
});

##Output JavaScript objects from JSON strings.

var Parser = require("json-stream").Parser;

http.get(options).on("response", function (response) {
  response.pipe(new Parser()).on("data", function (object) {
    //Handle `object`
  });
});

#Test

Run the tests with:

$ npm test

#License

MIT.

About

Output JavaScript objects from a JSON string input. And do the same the other way.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published