Advertisement

Client.zip

: Extremely small footprint for your frontend project. How to implement it: javascript

import { downloadZip } from "client-zip"; async function saveArchive() { // Define your files (can be Blobs, Strings, or Fetch responses) const files = [ { name: "hello.txt", lastModified: new Date(), input: "Hello World" }, { name: "image.png", input: fetch("https://example.com") } ]; // Generate the ZIP blob const blob = await downloadZip(files).blob(); // Create a download link const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "photos.zip"; link.click(); } Use code with caution. Copied to clipboard client.zip

Stop sending raw data to your server just to zip it. You can generate ZIP archives directly in the browser using the library. Why use it? : Extremely small footprint for your frontend project