zlib.flush([kind, ]callback)


  • kind 默认值: 对于基于 zlib 的流,zlib.constants.Z_FULL_FLUSH;对于基于 Brotli 的流,zlib.constants.BROTLI_OPERATION_FLUSH
  • callback <Function>

刷新挂起的数据。不要轻率调用此操作,过早刷新会对压缩算法的效果产生负面影响。

🌐 Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm.

调用这个方法只会将数据从内部的 zlib 状态中刷新出来,并不会在流级别上执行任何类型的刷新。它的行为更像是正常的 .write() 调用,即它会排在其他待处理写操作的队列中,只有在从流中读取数据时才会产生输出。

🌐 Calling this only flushes data from the internal zlib state, and does not perform flushing of any kind on the streams level. Rather, it behaves like a normal call to .write(), i.e. it will be queued up behind other pending writes and will only produce output when data is being read from the stream.