How can chunks be allocated in a node.js stream in object mode all at once?
- by Quentin Engles
I can see how buffers, and strings can be sent as chunks, but I'm having a problem thinking about how streams can be dealt when working in object mode.
Say I have a byte stream from an http request message. I want to take that message, parse, and then transform it into one big object.
I already know how to parse the message. What I'm wondering is if the message is big so it has many chunks, but I want to make one object for the output how can I make sure the data event waits for the whole thing?
Is this just a matter of not using the push method until the chunked data has finished being sent?
That would then restrict the stream data output to a smaller object which I think I'm fine with for now.
As an added condition the larger data will be reduced in size after the the transform.