yoshihitoh / zstd-codec

Zstandard codec for Node.js and Web, powered by Emscripten
MIT License
188 stars 28 forks source link

Expose streams API #302

Open akg1 opened 7 months ago

akg1 commented 7 months ago

We currently have a setup where we can use different compression algorithms to decompress the data, and most work with some pattern of the following:

const stream = openStream();

let decompressedStream;
switch (compressionAlgorithm) {
   case 'none':
      decompressedStream = stream;
      break;

   case 'algA':
      decompressedStream = stream.pipe(AlgA.createDecodeStream())
      break;
 // etc
}

The ZstdCompressTransform in lib/zstd-stream.js looks very close to being able to do this, but as far as I can tell, it's not exposed via the npm package index.

yoshihitoh commented 3 months ago

Sorry for too late reply;

zstd-codec supports both browser and Node.js environments. When I worked on this project, stream API was unavailable in the browser environment, so I didn't expose ZstdCompressTransform.

According to the MDM, the Stream API is available and supported by major browsers. I'll consider exposing the module.