Skip to content

Latest commit

 

History

History

range-coder

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@thi.ng/range-coder

npm version npm downloads Twitter Follow

This project is part of the @thi.ng/umbrella monorepo.

About

Range encoder / decoder for binary data, based on Java implementation by Joe Halliwell.

Installation

yarn add @thi.ng/range-coder

Dependencies

API

import * as rc "@thi.ng/range-coder";
// prepare dummy data
src = new Uint8Array(1024);
src.set([1,1,1,1,1,2,2,2,2,3,3,3,4,4,5,4,4,3,3,3,2,2,2,2,1,1,1,1,1], 512);

// pack data
packed = rc.encodeBytes(src);

packed.length
// 146

packed.length/src.length
// 0.142578125

// unpack
dest = rc.decodeBytes(packed);

Authors

  • Karsten Schmidt

License

© 2017 Karsten Schmidt // Apache Software License 2.0