Skip to content

justdevw/JSSC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

176 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSSC

JSSC — JavaScript String Compressor   NPM Socket score codecov CI License

JSSC is an open-source, lossless string compression algorithm designed specifically for JavaScript strings (UTF-16). It produces compressed data that remains a valid JS string, making it ideal for environments where binary data is difficult to handle.

Note: The npm package is named strc.
The jssc ("jSSC") npm package is unrelated to this project.
Both names (uppercase "JSSC" and lowercase "strc") refer to the same project.

JSSC is a complex algorithm featuring multiple internal compression modes tailored for different data structures. During compression, each mode evaluates the input; if its specific conditions are met, it produces a candidate string. JSSC then selects the best candidate — the one that achieves the highest compression ratio while passing a mandatory lossless decompression check. This approach results in a slower compression phase but ensures high compression ratio and fast decompression, as no brute-forcing or validation is required during recovery.

⚠️ Compatibility Notice: Compressed strings from v1.x.x are not compatible with v2.x.x due to header and encoding changes. JSSC follows Semantic Versioning: successful decompression is guaranteed only if the decompressor version is equal to or newer than the compressor version (within the same major version).

Key Features

  • ~2.5:1 average compression ratio.
  • String-to-String: No binary buffers or external metadata.
  • Self-validating: Compressed string is guaranteed to be successfully decompressed and with no data loss.

    If the string was corrupted or compressed by a later version or if it was compressed with a different major version following the Semantic Versioning standard, then there is no guarantee that the compressed string will be successfully decompressible without any data loss.

  • TypeScript support and a fully-typed API.

Documentation

Full documentation, API reference, and live examples are available at jssc.js.org.

Quick start

npm i strc
import { compress, decompress } from 'strc';

const data = "Hello, world!";
const compressed = await compress(data);
const original = await decompress(compressed);

CLI:

npx jssc --help

Website/Browsers:

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

Dependencies

JSSC depends on:


JSSC CLI and format handling (.jssc) depends on:


Note: All dependencies (except JUSTC) are bundled into the final build.

License

MIT © 2025-2026 JustDeveloper


NPM

About

JavaScript String Compressor - lossless string compression algorithm

Resources

License

Stars

Watchers

Forks

Contributors