npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kitmodule/kitzip

v1.0.4

Published

Generate ZIP files in vanilla JavaScript lightweight, dependency-free, and easy to use.

Readme

💾 KitZip JS by Kitmodule

Generate ZIP files in vanilla JavaScript — lightweight, chainable, and dependency-free.

English | Tiếng Việt

npm version license

✨ Features

  • 📦 Create ZIP files from strings, JSON, ArrayBuffer, or base64.
  • 🔗 Add files from URLs with optional progress tracking.
  • ⚡ Pure vanilla JavaScript, zero dependencies.
  • 🧱 Fluent, chainable API for building archives.
  • 🔒 Supports compression (Deflate) if the browser supports it.
  • 📊 Optional progress callback for both individual files and total ZIP.

🚀 Installation

Using npm

npm install @kitmodule/kitzip

Using CDN

<script src="https://unpkg.com/@kitmodule/kitzip/dist/kitzip.min.js"></script>

💡 Usage

1️⃣ Initialize with file array (constructor)

const initialFiles = [
  { name: 'a.txt', content: 'Hello' },
  { name: 'b.txt', content: 'World' }
];

const zip = new KitZip(initialFiles, { compress: true });
await zip.download('init-files.zip');

✅ Convenient if you already have a list of files.

2️⃣ Initialize empty and add files dynamically

const zip = new KitZip({ compress: false }); // empty, no compression

zip.add('file1.txt', 'Hello World!');
zip.add('file2.json', JSON.stringify({ version: 4 }));

// Add file from URL
await zip.addURL('https://example.com/file.txt', 'remote.txt');

await zip.download('add-method.zip');

✅ Flexible for dynamic files, e.g., fetched from APIs or user input.

3️⃣ Shortcut helper kitZip(files, filename)

await kitZip([
  { name: 'x.txt', content: 'X content' },
  { name: 'y.txt', content: 'Y content' }
], 'shortcut.zip');

✅ Short and simple: just pass a file array and target ZIP filename.

4️⃣ Combine files + opts + .add() (advanced)

const files = [
  { name: 'a.txt', content: 'A' }
];

const zip = new KitZip(files, { compress: true });

// Add a new file with custom compression
zip.add('b.txt', 'B content', { compress: false });

// Track progress
zip.setProgressHandler((percent, info) => console.log(percent, info));

await zip.download('mixed.zip');

✅ Useful for mixed compression settings or tracking ZIP progress.

🧩 API Reference

new KitZip(files?, options?)

| Param | Type | Description | | | --------- | ------ | -------------------------------------------------------------- | --------------------- | | files | Array | Optional array of initial files { name, content, compress? } | | | options | Object | { compress: true | false }Defaulttrue |

Methods

| Method | Description | Example | | -------------------------- | --------------------------------------------------------- | ------------------------------------------ | | .add(name, content) | Add a file (string, JSON, ArrayBuffer, base64) | .add('hello.txt', 'Hello') | | .addURL(url, name, opts) | Add a file from a URL with optional onProgress callback | .addURL('file.txt', 'file.txt') | | .setCompression(bool) | Enable/disable compression for following files | .setCompression(false) | | .setProgressHandler(fn) | Callback (percent, info) for total progress | .setProgressHandler(console.log) | | .download(filename) | Generate ZIP Blob and trigger download | .download('archive.zip') | | .createStream(writer) | Stream ZIP to a custom writer with write(chunk) | .createStream(customWriter) | | kitZip(files, filename) | Shortcut to create and download ZIP from file array | kitZip([{name:'a',content:'1'}],'a.zip') |

🧪 Example Output

const zip = new KitZip();
zip.add('hello.txt', 'Hello World!');
await zip.download('demo.zip');

Output ZIP demo.zip contains:

hello.txt
readme.md
data.json

☕ Support the Author

If you find this library useful, you can support me:

Ko-fi Buy Me a Coffee GitHub Sponsors Patreon PayPal

🧾 License

Released under the MIT License © 2025 Huỳnh Nhân Quốc · Open Source @Kit Module