zlib.flush([kind, ]callback)
kind
默认值:zlib.constants.Z_FULL_FLUSH
用于基于 zlib 的流,zlib.constants.BROTLI_OPERATION_FLUSH
用于基于 Brotli 的流。callback
<Function>
刷新挂起的数据。 不要轻率地称之为,过早刷新会对压缩算法的有效性产生负面影响。
调用它只会从内部 zlib
状态刷新数据,并且不会在流级别执行任何类型的刷新。
相反,它的行为类似于对 .write()
的正常调用,即它将排队等待其他未决写入,并且仅在从流中读取数据时才产生输出。
kind
Default:zlib.constants.Z_FULL_FLUSH
for zlib-based streams,zlib.constants.BROTLI_OPERATION_FLUSH
for Brotli-based streams.callback
<Function>
Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm.
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.