leb128 0.9.0 leb128: ^0.9.0 copied to clipboard
A Dart package that can read and write numbers in the LEB128, short for Little Endian Base 128, format.
import 'package:leb128/leb128.dart';
void main() {
var input = -9019283812387;
// Encode the large number shown above
var output = Leb128.encode(input);
// Print the individual bytes of the encoded
// number in hex
output.forEach((x) {
print(x.toRadixString(16));
});
// Decode the LEB128 number into an ordinary integer and
// print it
print(Leb128.decodeSigned(output, 64));
}