UNPKG

greenhorn

Version:

A simple server that renders HTML using various engines and a configuration file with test data

21 lines (15 loc) 285 B
var concat = require('concat-stream'); module.exports = getStreamJSON; function getStreamJSON(stream, cb) { var cs = concat(function (data) { var json; try { json = JSON.parse(data); } catch (e) { return cb(e); } return cb(null, json); }); stream.pipe(cs); }