gildas-lormeau / zip.js

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
https://gildas-lormeau.github.io/zip.js
BSD 3-Clause "New" or "Revised" License
3.41k stars 510 forks source link

How to disable compression of a newly created ZIP? #427

Closed drauch closed 1 year ago

drauch commented 1 year ago

I just want to use the "archive" feature of ZIP and put some files into a ZIP, how to forego compression?

Best regards, D.R.

gildas-lormeau commented 1 year ago

You have to set the option level to 0.

See here for an example of code: https://github.com/gildas-lormeau/zip.js/blob/eb89a9c2448bd13637a86cb60c8784c33b5ae43f/tests/all/test-store.js#L15. See here for the documentation: https://gildas-lormeau.github.io/zip.js/api/interfaces/ZipWriterConstructorOptions.html#level.