Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

use-save-files-as-zip

anix25MIT0.1.8TypeScript support: included

This is a basic library to pass an array of Files and generate a zip file and download.

react-zip, zip-files, save-zip, download-zip, save-as-a-zip, reazt-files, zip, img-zip

readme

useSaveFilesAsZip

This is a basic library to pass an array of Files and generate a zip file and download.

Commands

Install library npm install use-save-files-as-zip

How to use

// The initialState is optional but if we need to add it just add a File array
const { setFilesAsZip, saveAsZip } = useSaveFilesAsZip();

// Here we can add all the files that we need to add to generate the ZIP file.
setFilesAsZip(files);
// Here we execute the instruccion to download the ZIP file
saveAsZip();

Extras

const { files, urls } = useSaveFilesAsZip();

files; // All the files that you add to generate the ZIP file
urls; // It is an array that contains all the urls from the files and with this you can download indivitually

// Example to download any file
<a href={urls[0]} download>
  Download
</a>;

If you want to contribute

Install dependencies npm install

Run project npm start