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

strc

v2.0.5

Published

JavaScript String Compressor - lossless string compression algorithm

Readme

JSSC — JavaScript String Compressor

JSSC (JavaScript String Compressor) is an open-source, lossless string compression algorithm designed specifically for JavaScript.

It operates directly on JavaScript strings (UTF-16) and produces compressed data that is also a valid JavaScript string.

JSSC is distributed as a UMD module and can be used in browsers, Node.js, Deno, and other JavaScript environments.

Key Features

  • Lossless compression
  • 🗜️ High compression ratios
    • up to 8:1 for numeric data
    • strong results for repetitive and structured text
  • 🌍 Multilingual support
    • English, Russian, Japanese, Chinese, Hindi, Bengali, and more
  • 📦 JSON support
    • JSON is converted to JUSTC before compression
  • ⚙️ String → String
    • no binary buffers
    • no external metadata
    • all required information is embedded into the compressed string itself
  • 🧠 Self-validating compression
    • every compression mode is verified by decompression before being accepted
  • 🔁 Recursive compression
  • 📜 TypeScript definitions included
  • 🌐 UMD build for browsers and static websites

Important Version Compatibility Notice

⚠️ Compressed strings produced by JSSC v1.x.x are NOT compatible with v2.x.x

Reasons:

  • The first 16 bits (header layout) were slightly redesigned
  • New compression modes were added
  • Character encoding tables were extended

Character Encoding

JSSC operates on JavaScript UTF-16 code units, not on UTF-8 bytes.

This means:

  • Any character representable in a JavaScript string is supported
  • Compression works at the UTF-16 level
  • One JavaScript character = 16 bits
  • Binary data must be converted to strings before compression

Project Name vs npm Package Name

The project is called JSSC (JavaScript String Compressor).

The npm package is published under the name strc, because the name jssc is already occupied on npm by an unrelated Java-based package.

Both names refer to the same project.

Installation

Install via npm

npm i strc

The npm package name is strc, but the library itself is JSSC.

Or you can use it on your website by inserting the following HTML script tags.

<script src="https://unpkg.com/justc"></script>
<script src="https://unpkg.com/strc"></script>

Usage

JavaScript

const { compress, decompress } = require('strc');

const example = await compress("Hello, world!");
await decompress(example);

TypeScript

import { compress, decompress } from 'strc';

const example = await compress("Hello, world!");
await decompress(example);

Deno (server-side)

import JSSC from 'https://jssc.js.org/jssc.min.js';

const example = await JSSC.compress("Hello, world!");
await JSSC.decompress(example);

Browsers / Frontend (UMD)

When using the UMD build via CDN, the library is exposed globally as JSSC.

<script src="https://unpkg.com/justc"></script>
<script src="https://unpkg.com/strc"></script>
const compressed   = await JSSC.compress("Hello, world!");
const decompressed = await JSSC.decompress(compressed);

API

compress(input: string | object | number): Promise<string>

Compresses the input and returns a compressed JavaScript string.

decompress(input: string, stringify?: boolean): Promise<string | object | number>

Decompresses a previously compressed string/object/integer.

Dependencies

JSSC depends on:

License

MIT © 2025-2026 JustDeveloper


Minified Build

For .min.js, I use UglifyJS by Mihai Bazon.

npm i uglify-js
uglifyjs index.js -c -m "reserved=['compress','decompress']" -o index.min.js