High-performance, zero-dependency TypeScript & JavaScript library for creating and compressing
.zipfiles in memory.
cellizip is designed to work seamlessly in modern JavaScript runtimes: Browser, Node.js (18+), Deno, Bun, and Cloudflare Workers / Edge Runtimes.
- 🚀 Zero External Dependencies: Ultra-lightweight, fast, and footprint-free.
- ⚡ DEFLATE & STORE Compression: Uses native
CompressionStreamfor DEFLATE compression and provides synchronous STORE mode. - 🔤 Full UTF-8 Support: Filenames with special characters, accents, and emojis (
UTF-8 Language Encoding FlagPKZIP). - 🌐 Cross-Platform: Works identically in Browsers and Server runtimes.
- 📘 TypeScript Ready: Written entirely in TypeScript with
.d.tsdeclarations included out of the box.
npm install cellizip
# or
yarn add cellizip
# or
pnpm add cellizipOr directly import cellizip.ts / dist/cellizip.js into your project!
import cellizip from 'cellizip';
const zip = new cellizip();
// Add text strings, Uint8Array, ArrayBuffer, or Blob
zip.add('hello.txt', 'Hello World!');
zip.add('data/users.json', JSON.stringify([{ id: 1, name: 'Alice' }]));
zip.add('images/logo.png', logoUint8Array);
// Create an empty folder
zip.add('empty_folder/', '', { isDir: true });
// Generate binary ZIP file (Uint8Array) with DEFLATE compression
const zipBuffer = await zip.generateAsync({ compression: 'DEFLATE' });For scenarios where instant response time is critical without asynchronous processing:
import cellizip from 'cellizip';
const zip = new cellizip();
zip.add('notes.txt', 'Quick content');
const uint8Array = zip.generateSync(); // Ultra-fast synchronous generationimport cellizip from 'cellizip';
// Asynchronous ZIP creation
const zipData = await cellizip.zip({
'file1.txt': 'Text content 1',
'config.json': '{"active": true}',
});
// Synchronous ZIP creation
const zipSyncData = cellizip.zipSync({
'file1.txt': 'Text content 1',
'config.json': '{"active": true}',
});import cellizip from 'cellizip';
async function downloadZip() {
const zip = new cellizip();
zip.add('document.pdf', pdfArrayBuffer);
zip.add('info.txt', 'Created with cellizip!');
// Helper to generate a Blob ready for browser download
const blob = await zip.generateBlob({ compression: 'DEFLATE' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'archive.zip';
link.click();
URL.revokeObjectURL(link.href);
}import cellizip from 'cellizip';
import * as fs from 'node:fs/promises';
async function saveZip() {
const zip = new cellizip();
zip.add('report.txt', 'Report generated at ' + new Date().toISOString());
const zipBytes = await zip.generateAsync({ compression: 'DEFLATE' });
await fs.writeFile('report.zip', zipBytes);
}-
add(path: string, content?: ZipInput, options?: AddOptions): thisAdds a file or directory entry to the ZIP archive.path: File path inside the archive (e.g.'folder/file.txt').content: String,Uint8Array,ArrayBuffer, orBlob.options:compression:'STORE'|'DEFLATE'date: ModificationDateobject (default: current date).comment: Entry comment.isDir:boolean(truefor directories).
-
has(path: string): booleanChecks whether an entry exists in the archive. -
remove(path: string): booleanRemoves an entry from the archive. -
clear(): voidRemoves all entries from the archive. -
generateAsync(options?: GenerateOptions): Promise<Uint8Array>Generates the binary ZIP archive asynchronously.options.compression:'STORE'|'DEFLATE'(default:'STORE')options.comment: Global ZIP archive comment.
-
generateSync(options?: GenerateOptions): Uint8ArrayGenerates the binary ZIP archive synchronously (uses'STORE'mode). -
generateBlob(options?: GenerateOptions, mimeType?: string): Promise<Blob>Browser helper to return aBlobrepresentation of the ZIP archive.
-
cellizip.zip(entries: Record<string, ZipInput>, options?: GenerateOptions): Promise<Uint8Array>One-line asynchronous ZIP creation. -
cellizip.zipSync(entries: Record<string, Exclude<ZipInput, Blob>>, options?: GenerateOptions): Uint8ArrayOne-line synchronous ZIP creation.
crc32(data: Uint8Array): number: Calculates the CRC-32 checksum of a byte array.toDosDateTime(date: Date): { time: number, date: number }: Converts a JavaScriptDateto 16-bit MS-DOS time and date numbers.
MIT © 2026