dweinstein / json-stream-response

send the HTTP application/json header and stream a HTTP json response

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SYNOPSIS

Stream a JSON response from an http server. Useful for when restify doesn't send a content-type by default when you send a JSON stream through it... this does.

USAGE

var jsr = require('json-stream-response');

function requestHandler(req, res, next) {
  // ...
  var ws = jsr(res);
  ws.write(bigJSONThing);
  ws.write(bigJSON2);
  ws.end();
  res.on('finish', next);
}

About

send the HTTP application/json header and stream a HTTP json response

License:MIT License


Languages

Language:JavaScript 100.0%