leb128 0.9.0 copy "leb128: ^0.9.0" to clipboard
leb128: ^0.9.0 copied to clipboard

outdated

A Dart package that can read and write numbers in the LEB128, short for Little Endian Base 128, format.

LEB128 Encoder/Decoder #

This package offers easy-to-use methods that let you encode and decode LEB128 data. LEB128, which is short Little Endian Base 128, is a code compression algorithm that is used in a variety of file formats. The most well-known are WebAssembly's binary .wasm and Android's .dex files.

Usage #

  • You can call the Leb128.encode() method to convert a Dart int value into an LEB128 list of bytes. The list is a Uint8List object.

  • You can call the Leb128.decodeSigned() method to convert a Uint8List object into a Dart int value. Use this method for signed LEB128 integers only.

  • You can call the Leb128.decodeUnsigned() method to convert a Uint8List object into a Dart int value. Use this method for unsigned LEB128 integers only.

Both the decoder methods expect you to specify the number of bits in your LEB128 integer. For example, a varint7 has 7 bits, and a varint32 has 32 bits.

This package also offers two utility methods namedLeb128.decodeVarint7() and Leb128.decodeVaruint7(), which are easier to use if you need to convert a single byte of data.

2
likes
0
pub points
47%
popularity

Publisher

unverified uploader

A Dart package that can read and write numbers in the LEB128, short for Little Endian Base 128, format.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on leb128