更改readstream chunksize [英] Changing readstream chunksize
本文介绍了更改readstream chunksize的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个基于套接字的文件传输系统,因此我遇到了一些麻烦。我想使用node的fs.createReadStream()读取块中的文件,但是我无法从665536更改块大小。我找不到任何关于此的内容。
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.
推荐答案
根据ReadStream代码,您应该能够通过在ReadStream选项中显式设置它来增加 highWaterMark
:
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 });
这篇关于更改readstream chunksize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文