2

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

new File(filePath)
   .openRead()
   .transform(new ZLibDeflater())
   .pipe(new File(gzipPath).openWrite())
   .then(...);

由于 ZLibDeflater现在已弃用,如何转换代码以使用新的GZipCodec类?

4

2 回答 2

5

您还可以使用ZLIB

new File(filePath)
  .openRead()
  .transform(ZLIB.decoder)
  .pipe(new File(zlibPath).openWrite())
  .then(...);
于 2013-08-30T14:27:14.643 回答
0

尽早放弃,您可以使用Converter.bind()转换流的方法简单地做到这一点:

const GZipCodec()
    .encoder.bind(new File(filePath).openRead())
    .pipe(new File(gzipPath).openWrite())
    .then(...)
于 2013-08-30T14:11:26.960 回答