JavaScript String Compressor - lossless string compression algorithm
npm install strcIt 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.
Reasons:
- The first 16 bits (header layout) were slightly redesigned
- New compression modes were added
- Character encoding tables were extended
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
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.
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.
`html
`Usage
#### JavaScript
`js
const { compress, decompress } = require('strc');const example = await compress("Hello, world!");
await decompress(example);
`#### TypeScript
`ts
import { compress, decompress } from 'strc';const example = await compress("Hello, world!");
await decompress(example);
`#### Deno (server-side)
`ts
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.
`html
`
`js
const compressed = await JSSC.compress("Hello, world!");
const decompressed = await JSSC.decompress(compressed);
`API
#### compress(input: string | object | number): Promise
Compresses the input and returns a compressed JavaScript string.####
decompress(input: string, stringify?: boolean): Promise
Decompresses a previously compressed string/object/integer.Dependencies
JSSC depends on:
-
JUSTC by JustStudio.License
MIT Ā© 2025-2026 JustDeveloper---
Minified Build
For .min.js, I use UglifyJS by Mihai Bazon.
`bash
npm i uglify-js
`
`bash
uglifyjs index.js -c -m "reserved=['compress','decompress']" -o index.min.js
``