Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hathibelagal-dev/leb128
A Dart package that lets you encode and decode LEB128 integers
https://github.com/hathibelagal-dev/leb128
encoding-decoding leb128
Last synced: about 2 months ago
JSON representation
A Dart package that lets you encode and decode LEB128 integers
- Host: GitHub
- URL: https://github.com/hathibelagal-dev/leb128
- Owner: hathibelagal-dev
- License: apache-2.0
- Created: 2019-02-20T17:03:25.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-20T18:34:25.000Z (over 1 year ago)
- Last Synced: 2023-08-20T22:29:26.198Z (over 1 year ago)
- Topics: encoding-decoding, leb128
- Language: C++
- Homepage: https://pub.dev/packages/leb128
- Size: 305 KB
- Stars: 5
- Watchers: 0
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# LEB128 Encoder/Decoder
This package offers easy-to-use methods that let you encode and decode LEB128 data. LEB128, which is short for **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.encodeSigned()` method to convert a Dart `int` value into an LEB128 list of bytes. The list is a `Uint8List` object. Use this method for both positive and negative values.
- You can call the `Leb128.encodeUnsigned()` method to convert a Dart `int` value, which is positive, into an LEB128 list of bytes.
- 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.
This package also offers two utility methods named`Leb128.decodeVarint7()` and `Leb128.decodeVaruint7()`, which are easier to use if you need to convert a single byte of data.