client-zip is a lightweight, dependency-free JavaScript library for client-side generation of streaming ZIP archives directly in the browser. It allows developers to concatenate multiple files, often fetched from HTTP requests, into a single downloadable ZIP file without server-side processing. The current stable version is 2.5.0, with regular patch and minor releases indicating active maintenance. Key differentiators include its small bundle size (2.6kB gzipped), superior performance compared to alternatives like JSZip (reportedly 40x faster), and native support for modern browser streaming APIs. It handles Zip64 archives, necessary for large files, though this means generated ZIPs require a reader compatible with "ZIP version 4.5" and may not be universally readable by all older ZIP utilities. It does not perform file compression or unzipping.
npm install client-zipVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `downloadZip` to create a ZIP file from multiple inputs (a string and a fetched resource) and initiate a client-side download.
Ensure your build target is ES2020 or higher (e.g., `"target": "ES2020"` in tsconfig.json, or configure Babel accordingly). For compatibility with ES2018 or lower, use client-zip v1.x, which does not utilize BigInts.
Inform users that archives generated by v2.x require a modern ZIP reader compatible with Zip64. If broad compatibility with very old tools is critical, consider using client-zip v1.x.
When providing an `AsyncIterable` as input, ensure its iterator's `return` method is robust and can handle errors gracefully if the output stream is unexpectedly cancelled mid-process.
If your archive contains non-ASCII filenames and is encountering display issues, set the `buffersAreUTF8: true` option in `downloadZip` or `makeZip` options.
Always call `URL.revokeObjectURL(blobUrl)` after the generated Blob URL is no longer needed (e.g., after a download has started or completed, or when the temporary link is removed).
Update your project's JavaScript compilation target (e.g., in tsconfig.json or Babel configuration) to ES2020 or later. If targeting older environments is strictly necessary, use client-zip v1.x.
Use a modern ZIP extraction tool that supports Zip64 (ZIP version 4.5). For maximum compatibility with very old tools, consider using client-zip v1.x.
Ensure `URL.revokeObjectURL(blobUrl)` is called for every Blob URL generated, typically after the associated download or use case is complete.
No dependency data recorded yet.