readable.push('')
不推荐使用 readable.push('')
。
¥Use of readable.push('')
is not recommended.
将零字节 <string>、<Buffer>、<TypedArray> 或 <DataView> 推送到不处于对象模式的流会产生有趣的副作用。因为是对 readable.push()
的调用,调用会结束读取过程。然而,因为参数是一个空字符串,所以没有数据被添加到可读缓冲区,所以用户没有任何东西可以使用。
¥Pushing a zero-byte <string>, <Buffer>, <TypedArray> or <DataView> to a stream
that is not in object mode has an interesting side effect.
Because it is a call to
readable.push()
, the call will end the reading process.
However, because the argument is an empty string, no data is added to the
readable buffer so there is nothing for a user to consume.