rle-data
v0.1.2
Published
Run-length encoding for JS
Downloads
75
Maintainers
Readme
Run-length encoding
A tiny (150 bytes) binary run-length encoding (RLE) packer/unpacker
The article about Run Length Algorithm is here. My usecase of rle-data
is create binary matrix for image segmentation (Canvas) to reduce data size.
Encoding format
Incoming data
[0, 0, 0, 0, 0, 1, 1, 0, 0];
Outgoing data
[5, 0, 2, 1, 2, 0];
Decoding format
Incoming data
[4, 0, 4, 1, 3, 0];
Outgoing data
[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0];
Installation
npm i rle-data
API
let rle = require("rle-data");
rle.encode([0, 0, 0, 0, 0, 1, 1, 0, 0]);
rle.decode([4, 0, 4, 1, 3, 0]);
Roadmap
- Add other formats to compression
- Use smart data compression
- R&D best practices of RLE