Closed baidongying closed 3 years ago
Which version of Node.js used on the test server? v10.x or later version are all supported.
https://github.com/nodejs/node/blob/master/lib/internal/fs/streams.js#L193
可能是测试服务器上node版本过低,建议使用10.x以上版本,本地v10.18.0
测试没有问题
test.js
const string2fileStream = require('./index.js');
string2fileStream("test");
console
$ /c/Users/zhangjufeng/Downloads/node-v8.9.0-win-x64/node-v8.9.0-win-x64/node test.js
buffer.js:224
throw err;
^
TypeError: "size" argument must be a number
at Function.Buffer.allocUnsafe (buffer.js:251:3)
at allocNewPool (C:\Users\zhangjufeng\gh\string-to-file-stream\index.js:21:19)
at ReadStream._read (C:\Users\zhangjufeng\gh\string-to-file-stream\index.js:118:5)
A fix #4
The latest version(@1.3.0) fixed this, thanks to @zjffun , it's turn to close.
this.readableHighWaterMark 未定义,在测试服务器上导致报错了