@confuzzle/move-to-front

1.0.0 • Public • Published

@confuzzle/move-to-front

This package contains a naive, inefficient implementation of the Move-to-front transform.

For details of how this can be used together with the Burrows-Wheeler transform to improve compression, see this excellent blog post by Tommy Reddad.

See also

Functionality

This package provides two functions:

  • forward(s), which runs Buffer.from(s) and performs the forward transform on the result
  • inverse(x), which runs Buffer.from(x) performs the inverse transform on the result Both functions return a Buffer object.

Example Usage

const mtf = require('@confuzzle/move-to-front');
const s = 'abracadabra';
const t = mtf.forward(s);
const inv = mtf.inverse(t).toString();
console.log(inv) // abracadabra

Package Sidebar

Install

npm i @confuzzle/move-to-front

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

2.41 kB

Total Files

3

Last publish

Collaborators

  • rjkat