I have a function call uploadStream(compressedStream)
in my code where I am passing compressedStream
as a parameter to the function but before that I need to determine the length of the compressedStream
.
Does anyone know how can I do that in NodeJS?
Advertisement
Answer
you can get length by getting stream chunks length on the “data” event
compressedStream.on('data', (chunk) => { console.log('Got %d characters of string data:', chunk.length); });