Dart 如何用ZLibDeflater代替ZLibDeflater

Dart 如何用ZLibDeflater代替ZLibDeflater,dart,dart-io,Dart,Dart Io,我使用ZLibDeflater压缩文件,将其作为流读取并转换: 新文件(文件路径) .openRead() .transform(新的ZLibDeflater()) .pipe(新文件(gzip路径).openWrite()) .然后(…); 作为ZLibDeflater,我如何转换代码以使用新类?放弃了早期,您可以使用转换流的方法简单地完成: const gzip代码() .encoder.bind(新文件(filePath).openRead()) .pipe(新文件(gzip路径).op

我使用ZLibDeflater压缩文件,将其作为流读取并转换:

新文件(文件路径)
.openRead()
.transform(新的ZLibDeflater())
.pipe(新文件(gzip路径).openWrite())
.然后(…);

作为ZLibDeflater,我如何转换代码以使用新类?

放弃了早期,您可以使用转换流的方法简单地完成:

const gzip代码()
.encoder.bind(新文件(filePath).openRead())
.pipe(新文件(gzip路径).openWrite())
.然后(…)
您还可以使用:

新文件(文件路径)
.openRead()
.transform(ZLIB.decoder)
.pipe(新文件(zlibPath).openWrite())
.然后(…);

转换器也是流变压器。那条路比我的好多了,谢谢!