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

@bazariodev/baler

v0.1.0

Published

Dependency-free ZIP creation with portable filenames and input limits.

Readme

@bazariodev/baler

Baler creates ZIP archives from named text files. It checks portable filenames, duplicate names, input size, and classic ZIP limits.

Install

pnpm add @bazariodev/baler

There are no runtime or peer dependencies. Node.js support is ^22.12.0 || ^24.0.0 || >=26.0.0. Browser and worker runtimes need Blob, TextEncoder, and typed arrays. Compression uses native Web APIs when available.

Usage

import { balingZip } from '@bazariodev/baler';

const blob = await balingZip([
  { name: 'results.txt', content: 'Completed: 42\n' },
  { name: 'settings.json', content: JSON.stringify({ mode: 'sample' }) },
]);

The result is a Blob with type application/zip. The application owns saving, downloading, or sending this Blob.

Pass { maxInputSize: 1_000_000 } as the second argument to set an input limit. Each call has separate archive data. Calls can overlap, including calls that use the same options object.

Behavior

  • Files contain text. Names and content use UTF-8. Empty files are included. An empty file list produces an empty ZIP. File order is preserved.
  • Input files are copied before compression starts. Later changes to the supplied array or file objects do not change the archive.
  • Filenames must be nonempty, valid Unicode, and at most 255 UTF-8 bytes. Paths, control characters, Windows device names, forbidden filename characters, and trailing spaces or periods are rejected. Names must be distinct after NFC normalization and conversion to lowercase. The original spelling is preserved. Device names with spaces before the extension, such as CON .txt, are also rejected.
  • No filename is reserved by Baler. Applications can include manifest.json.
  • The default input limit is 32,000,000 UTF-8 bytes across all file content. Names and ZIP headers do not count toward this limit. Input validation completes before compression starts. This limit does not bound heap use or native copies.
  • Each file's content is encoded once. Text that exceeds the remaining input limit by character count is rejected before encoding. The final check uses UTF-8 bytes.
  • Use ZIP method 8 when native CompressionStream('deflate-raw') succeeds. If compression is absent, unsupported, or fails, use ZIP method 0 for that file. See MDN CompressionStream.
  • Entries use the fixed modification date 1980-01-01 at 00:00:00. Baler does not copy filesystem timestamps or use the current time.
  • CRC-32, local headers, and the central directory describe each file. The archive must have fewer than 65,535 files and fewer than 4,294,967,295 bytes. ZIP64, directory entries, binary input, encryption, and archive reading are not supported.

API

| Function | Result | | --- | --- | | balingZip(files, options?) | Promise<Blob> containing one independent ZIP archive. | | validateFileNames(names) | Check an array of filenames; return void on success. | | validateZipOptions(options?) | Check options synchronously and return the resolved input limit in bytes. |

| Input | Meaning | | --- | --- | | files | Readonly array of { name: string, content: string }. | | options.maxInputSize | Positive safe integer. Maximum total UTF-8 content bytes. Default: 32,000,000. | | names | Readonly array of filenames to check before application work starts. |

balingZip validates its input. To reserve a filename in an application, pass that name and the requested names to validateFileNames before building files. Use validateZipOptions to reject invalid options before other application work starts. The default limit and its validation stay in Baler.

Errors

validateFileNames throws TypeError for invalid or duplicate names. validateZipOptions throws TypeError for an invalid input limit. balingZip rejects with TypeError for invalid files, names, content, or options. It rejects with RangeError when input size or a classic ZIP limit is exceeded. Native allocation failures can also reject the operation.

TypeScript

import { balingZip, type ZipFile } from '@bazariodev/baler';

const files: readonly ZipFile[] = [{ name: 'results.txt', content: 'ready' }];
const archive: Promise<Blob> = balingZip(files);

The package exports ZipFile and BalingZipOptions types. Use ES2022 and the DOM or WebWorker library types. ESM and CommonJS outputs have matching declarations.

License

MIT.