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

lz-mini-js

v0.1.0

Published

Compress source js code to no-dependencies self-decompressable js code

Readme

lz-mini-js

Compress source js code to no-dependencies self-decompressable js code.
lz-mini-js aims to provide as small output js code as possible and don't rely on external libraries for self-decompress.

Usage

CLI

npx lz-mini-js file.js file.lz.js

This command creates compressed js from file.js and write content to file.lz.js.
The result is fully standalone and does not require any dependencies to decompress itself. So it can be used as is in browsers or nodejs if you want.

API

Module is pretty simple:

const lzJs = require('lz-mini-js');
// ...
const compressedMinifiedCode = await lzJs('function decompressed() { return 42; }');
// write compressedMinifiedCode to file or pass anywhere else

lz-mini-js will minify only self-decompressor code using uglifyjs, source code to be compressed never minified by lz-mini-js.

If you want minify self-decompressor code by youself, pass false to second parameter:

const compressedCode = await lzJs(..., false);
// false means do not minify self-decompressor code
// here we can pass compressedCode to preferred minifier

How it works?

It uses lz-string lib for compressing and decompressing code, but with some tricks to reduce space usage in js code context. For compressing used lz-string itself, for decompressing - inlined version of decompressor.

Because of inlined decompressor lz-mini-js is not situable for very small scripts (~1k bytes and less), in this case decompressor itself is too big and compression profit is not notable. That's because we need to minify it by maximum.

To make self-decompressor extremely lightweight (~344 bytes using uglifyjs) it was almost fully rewritten with many assumptions. The main is compressed code string is always correct and we don't need to make any checks.

You can see inlined decompressor code in file src/lz-decompress.js, it's rewriten version of lz-string function _decompress.