@hazae41/rlp
v1.0.0
Published
RLP encoding for the web
Downloads
86
Maintainers
Readme
RLP
RLP encoding for the web
npm install @hazae41/rlpFeatures
Current features
- 100% TypeScript and ESM
- No external dependencies
- Rust-like patterns
Usage
Reading
import { Readable, Writable } from "@hazae41/binary"
import { Rlp, RlpList, RlpItem } from "@hazae41/rlp"
const list = RlpList.as(Readable.readFromBytes(Rlp, Uint8Array.fromHex(hex)))
const item0 = RlpItem.as(list.value[0])
const list1 = RlpList.as(list.value[1])
const item2 = RlpItem.as(list.value[2])
console.log(item0.value.toHex())Writing
import { Readable, Writable } from "@hazae41/binary"
import { RlpList, RlpItem } from "@hazae41/rlp"
const item0 = RlpItem.from(Uint8Array.fromHex("deadbeef"))
const item1 = RlpItem.from(Uint8Array.fromHex("1234abcd"))
const list = RlpList.from([item0, item1])
console.log(Writable.writeToBytes(list))