Best js package for zipping and attaching files to send to API?

40 Views Asked by At

I'm working on a Vue.js application and need to zip data into files, attach them to a zip folder, and then post the zip folder to an API. I've come across two packages, Zip and JSZip, but I'm unsure which one is better suited for my needs. I'll also need to unzip the file at some point and display its contents. Can anyone share their experiences with these packages and provide recommendations?

1

There are 1 best solutions below

0
Alexander Nenashev On

It's not related to Vue. Use any library of choice.

I would consider a native CompressionStream and gzip compression:

https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream

In my code there are only a few lines to compress and decompress data for various scenarios.

It's supported well and the last year was added to the rest of the browsers.