reason-rlp
v0.1.0-alpha.1
Published
[Recursive Length](https://github.com/ethereum/wiki/wiki/RLP) prefix encoding implementation in Reason.
Readme
Recursive Length Prefix Encoding
Recursive Length prefix encoding implementation in Reason.
Install
npm install reason-rlp
Install with -g if you want to use the cli.
Usage
var RLP = require('reason-rlp');
var assert = require('assert');
var nestedList = [ [], [[]], [ [], [[]] ] ]; /* Set theoretic representation of 3 */
var encoded = RLP.encode(nestedList);
var decoded = RLP.decode(encoded);
assert.deepEquals(nestedList, decoded);API
rlp.encode(plain) - RLP encoded an Array, Buffer or String and returns a Buffer
WIP rlp.decode(encoded, [skipRemainderCheck=false]) - Decodes an RLP encoded Buffer, Array
or String and returns a Buffer or an Array of Buffers. If skipRemainderCheck is enabled
rlp will just decode the first rlp sequence in the buffer. By default it would through an error
if there is more bytes in Buffer than used by the rlp sequence.
Tests
Tests use mocha. To run npm test
