Skip to content

DjonnyX/numeric-sequence-compressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Numeric sequence compressor

Numeric array compressor Compression quality is ~ 2 times better than the original separator-separated sequence of numbers

image

Important! The algorithm works correctly when the range of numbers in the array is from 0 to 1000.

Implementation of the "universal" algorithm (Needs some improvement) https://github.com/DjonnyX/numeric-sequence-compressor/tree/universal

Example

Install

npm i numeric-sequence-compressor

Import dependency to Your project:

const { serialize, deserialize } = require('numeric-sequence-compressor');

Serialization (Compression):

const arr = [0, 100, 25, 7, 47, 666];
const compressed = serialize(arr); 
console.log(compressed); // "0-34P7-1fkq"

Deserialization (Decompression):

const compressed = "0-34P7-1fkq";
const arr = deserialize(compressed); 
console.log(arr); // "[0, 100, 25, 7, 47, 666]"

Tests & benchmark

To run the benchmark with tests, run the command:

npm start

or

npm run test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published