@holochain/n-bch-rs

0.0.4 • Public • Published

n-bch-rs

nodejs bindings for rust bch reed-solomon library https://crates.io/crates/reed-solomon

Usage

const { Encoder, Decoder } = require('@holochain/n-bch-rs')

const enc = new Encoder(5)
const dec = new Decoder(5)

const res = enc.encode(Buffer.from([1, 2, 3]))

// corrupt
res.writeUInt8(0, 0)

dec.is_corrupted(res) // true

const fixed = dec.correct(res) // 1, 2, 3, ...parity bytes

Development

Uses rust's https://crates.io/crates/wasm-bindgen to generate webassembly. Currently only targeting nodejs.

To build:

# make sure you are using nightly rust
rustup default nightly

# install the wasm-bindgen commandline tool
cargo install wasm-bindgen-cli

# enter the rust directory
cd rust

# run the build script
./build.sh

Package Sidebar

Install

npm i @holochain/n-bch-rs

Weekly Downloads

2

Version

0.0.4

License

Apache-2.0

Unpacked Size

50.1 kB

Total Files

8

Last publish

Collaborators

  • mrruby
  • thetasinner
  • matthme
  • jost-s
  • guillem.cordoba
  • neonphog
  • connoropolous
  • lucksus
  • zippy314
  • thedavidmeister
  • maackle
  • peeech
  • zo-el
  • brisebom