• Version 2.2.7
  • Published
  • 62.9 kB
  • 1 dependency
  • MPL-2.0 license


npm i rlp
yarn add rlp
pnpm add rlp


Recursive Length Prefix Encoding Module



function decode

decode: {
(input: any, stream?: boolean): any;
(input: any[], stream?: boolean): any[];
(input: any, stream?: boolean): any;
  • RLP Decoding based on: RLP

    Parameter input

    will be converted to buffer

    Parameter stream

    Is the input a stream (false by default)


    - returns decode Array of Buffers containg the original message

function encode

encode: (input: Input) => any;
  • RLP Encoding based on: https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-RLP This function takes in a data, convert it to buffer if not, and a length for recursion

    Parameter input

    will be converted to buffer


    returns buffer of encoded data

function getLength

getLength: (input: Input) => Buffer | number;
  • Get the length of the RLP input

    Parameter input


    The length of the input or an empty Buffer if no input


interface Decoded

interface Decoded {}

    property data

    data: Buffer | Buffer[];

      property remainder

      remainder: Buffer;

        interface List

        interface List extends Array<Input> {}

          Type Aliases

          type Input

          type Input = Buffer | string | number | bigint | Uint8Array | BN | List | null;

            Package Files (2)

            Dependencies (1)

            Dev Dependencies (17)

            Peer Dependencies (0)

            No peer dependencies.


            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rlp.

            • Markdown
            • HTML
              <a href="https://www.jsdocs.io/package/rlp"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>