aaronmccall / simple-jsonstream

A simple transform stream to output a valid JSON array
MIT License
1 stars 0 forks source link

set objectMode=false on readable side to make Hapi happy #1

Open chesles opened 9 years ago

chesles commented 9 years ago

I am using this with Hapi, which as of 8.0.0 is throwing when it gets objectMode streams.

This module returns a stream in objectMode on the writable end, but not in objectMode on the readable end. The way it's being constructed now, the readable end is marked as object mode, so Hapi is throwing exceptions at me.

As described in the node stream docs this can be set up by setting this in the constructor:

this._writableState.objectMode = true;
this._readableState.objectMode = false;

I'm happy to send a PR with this change. Thanks for this module!

bleupen commented 9 years ago

+1 currently having to pipe transform streams through a PassThrough stream to please hapi

gavinmcdermott commented 7 years ago

@bleupen - I'm running into this issue. Can you link to an example of the solution that you found to work best for transforming the objectMode stream into a something that can be returned?