dominictarr / JSONStream

rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)
Other
1.92k stars 165 forks source link

Will JSONstream support zipped/gziped JSON instead of raw JSON #114

Closed hoogw closed 6 years ago

hoogw commented 7 years ago

My problem is a raw JSON file 100MB, if I zip it, it only has 18MB. 5 times smaller. I need to transfer JSON from server to browser, if I stream zipped json, will 5 time faster than stream raw JSON.

Will JSONstream support zipped/gziped JSON instead of raw JSON?

jsonstream.parser("http://abc.com/samplejson.zip") .on("*.item", function(item))

dominictarr commented 7 years ago

yes, but not like that.

instead, pipe the http stream through a ungzip stream

request("http://abc.com/samplejson.zip")
.pipe(zlib.createGunzip())
.pipe(JSONStream.parse('*.item'))
.on('data', ...)

hmm, request might even ungzip for you, if you the gzip headers are set, you'll have to look that up