prettyjson
prettyjson copied to clipboard
Question - Is there any way to use .pipe() in NodeJS with prettyjson
So for example could I do something like:
var file = fs.createReadStream('dogs.json');
file.pipe(prettyjson.render).pipe(response);
Using streams is not currently supported, as prettyjson decodes the whole JSON data at once.
Something similar to reading the process stdin could be done for streams.
I guess this is related to support stdin
output that is separated by newlines (such as JSONStream.stringify(false))?
Would be a great feature :-)
A current workaround using the JSONStream package: JSONStream < data.njs | prettyjson
.