You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/pdfkit/node_modules/http-browserify/example/json-stream/main.js

14 lines
381 B
JavaScript

var http = require('../../');
var JSONStream = require('JSONStream');
http.get({ path : '/data.json' }, function (res) {
var parser = JSONStream.parse([ true ]);
res.pipe(parser);
parser.on('data', function (msg) {
var div = document.createElement('div');
div.textContent = JSON.stringify(msg);
document.body.appendChild(div);
});
});