zstd-codec icon indicating copy to clipboard operation
zstd-codec copied to clipboard

How to compress / decompress in multiple steps?

Open lonnywong opened this issue 1 year ago • 1 comments

I want to compress / decompress in multiple steps, instead of getting all the chunks and then do it at once.

  • This is not what I want:
const chunks = [dataPart1, dataPart2, dataPart3, ...];
const compressed = streaming.compressChunks(chunks, size_hint);
  • What i want is:
withBindingInstance(new binding.ZstdDecompressStreamBinding(), (stream) => {
  stream.begin();
  stream.transform(dataPart1, mycallback);
  stream.transform(dataPart2, mycallback);
  stream.transform(dataPart3, mycallback);
  // ...
  stream.end(mycallback);
});
  • Question:
    • How to get the binding object?
    • Can you expose a API for it?

lonnywong avatar Apr 08 '23 02:04 lonnywong

Sorry for too late reply.

Currently, there is no way to get the binding directly due to the internal design. When I worked on this project, it was difficult for me to reuse the same binding object. Maybe it's possible to do it for now, I'll take a look in my free time.

yoshihitoh avatar Jul 04 '24 01:07 yoshihitoh