use-save-files-as-zip
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

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

Package Sidebar

Install

npm i use-save-files-as-zip

Weekly Downloads

8

Version

0.1.8

License

MIT

Unpacked Size

203 kB

Total Files

15

Last publish

Collaborators

  • anix