Tuesday, 6 June 2017

Send a huge content range using streams

How to send a part of file using read stream in response on HTTP request?

I want to send an arbitrary Content-Range of a huge file.

I can't use events when I do fs.createReadStream('hugeFile.bin').pipe(response) to filter out a part of readable stream. I can create a fake writable stream, which omits (like > /dev/null) a part of data, but chunk size may be not a multiple of a first part to send.

How to solve the problem?



via Orient

No comments:

Post a Comment