rle-compression

1.0.1 • Public • Published

RLE Compression for node and browser

Intall via NPM

Install rle-compression using npm , npm install rle-compression

API

All available functions are :

  • encode() : encoding method that walks the input string character by character.
  • encode_re() : encoding method that uses a regular expression to grab the character runs, uses forEach Method
  • decode() : decoding method that uses forEach method to package array of arrays to the original string.

Usage and Example

 
var RLE = require("rle-compression");
 
var originalMessage = "aaaaabbbbccccccccccccc";
console.log(originalMessage);
 
// using encode method of RLE compression
var encoded = RLE.encode(originalMessage);
// capture the encoded data and log on console
console.log(encoded);
 
// use the encoded data to get original message
var decoded = RLE.decode(encoded);
// capture the decoded data and log on console
console.log(decoded);
 
console.log(decoded == originalMessage);
 
 

License

Unless stated elsewhere, file headers or otherwise, the license as stated in the LICENSE file.

Package Sidebar

Install

npm i rle-compression

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.66 kB

Total Files

4

Last publish

Collaborators

  • yadav-arun