我正在尝试使用spawn
开始一个过程。我运行的程序
spawn
每秒输出几个字符。但是当最少字符数累积时,我得到了输出。有什么方法可以减少NodeJS
刷新缓冲区之前所需的最少字符数?
const spawnedCNN = spawn(this.CORE_ENV, args);
spawnedCNN.stdout.on('data', (data) => {
// RECEIVED WHEN MINIMUM AMOUNT OF DATA HAS BEEN ACCUMULATED
let { probList, err } = _createProbList(data.toString());
if (probList)
this.emit(_EVENT_MAP.DATA, probList);
else
this.emit(_EVENT_MAP.ERR, err);
});
spawnedCNN.stderr.on('data', (data) => {
this.emit(_EVENT_MAP.ERR, data);
});
spawnedCNN.on('close', (code) => {
this.emit(_EVENT_MAP.END, { code });
});