I'm trying to push some data chunk read from my stream in a Buffer array, like this:
const chunks = [];
readableStream.on('data', chunks.push);
But then, chunks
is empty.
The following works well but I'd like to find the difference between those two:
const chunks = [];
readableStream.on('data', (chunk) => chunks.push(chunk));
BTW, I'm using Node 6.2.2. Thank you
EDIT: I'm realizing there should be some context issue on the first line but explanations are welcome! Also, is there any recommandations/good practice on that?