Changing readstream chunksize

I'm trying to create a socket based filetransfer system and because of that I came up with some trouble. I want to read files in chunks using node's fs.createReadStream() but I was unable to change the chunk size from 665536. I couldn't find anything about this.

Answers:

Answer

According to the ReadStream code, you should be able to increase the highWaterMark by explicitly setting it in the ReadStream options:

var rs = fs.createReadStream('/foo/bar', { highWaterMark: 128 * 1024 });

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.