【发布时间】:2018-03-11 16:58:36
【问题描述】:
在转换函数中编写 NodeJS 转换流时,我如何知道该块是最后一个块还是没有任何新块到来。
_transform(chunk: any, encoding: string, callback: Function): void {
// accumulating chunks here to buffer
// so that I need to do some processing on the whole buffer
// and I need to understand when to do that
}
所以我需要知道进入 Stream 的块何时结束,对由所有块组成的缓冲区进行一些处理,然后从流中推送处理后的数据。
【问题讨论】:
标签: javascript node.js typescript