https://github.com/richardkiss/js_zfec
a JavaScript port of zfec: fast erasure coding
https://github.com/richardkiss/js_zfec
Last synced: 8 months ago
JSON representation
a JavaScript port of zfec: fast erasure coding
- Host: GitHub
- URL: https://github.com/richardkiss/js_zfec
- Owner: richardkiss
- Created: 2013-06-30T23:33:25.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-07-02T01:57:48.000Z (over 12 years ago)
- Last Synced: 2025-02-01T18:22:15.204Z (9 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 9
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
js_zfec
=======This is a port of zfec https://pypi.python.org/pypi/zfec, a fast erasure codec
for Python, into JavaScript.Overview
========This package performs two operations, encoding and decoding. Encoding takes
some input data and expands its size by producing extra "check blocks", also
called "secondary blocks". Decoding takes some data -- any combination of
blocks of the original data (called "primary blocks") and "secondary blocks",
and produces the original data.The encoding is parameterized by two integers, K and N. N is the total number
of blocks produced, and K is how many of those blocks are necessary to
reconstruct the original data. N is required to be at least 1 and at most
256, and k is required to be at least 1 and at most N.Usage
=====The fec.js file exports the symbol "fec".
Create an instance, passing in K and N.
// To encode:
var array_of_uint8
var f = fec(3, 10);
var encoded = f.encode(array_of_uint8);// encoded now contains 10 arrays of uint8, each just over 1/3rd the size
// of the original array_of_uint8 array.// To decode
// three arbitrary parts, from above
var f = fec(3, 10);
var parts = [encoded[3], encoded[6], encoded[7]];
var decoded = f.decode(parts);// now, decoded will equal the original array_of_uint8 above.
The data produced is compatible with the Python-based command-line tools
zfec and zunfec.