encode and decode base256 encoding as gnu-tar does (supported range is -9007199254740991 to 9007199254740991).
npm install base-256
How it is different than buffer.writeInt32BE
It's a variable length encoding.
const encode decode =const buf = 12// buf here is <Buffer 80 7f ff ff ffconst decodedValue =// decodedValue is 2147483647
Pass a buffer and the number that needs to be encoded. The number will be encoded into that buffer.
Decode a number from a buffer. If an offset is passed as the second argument the buf should be decoded at that byte offset. The byte offset defaults to 0.
TypeErrorif the input yields a number that is out of range (-9007199254740991 to 9007199254740991).
TypeErrorif the input is of not correct type.
TypeErrorif the output of decoded value of encoded buffer goes out of range -9007199254740991 to 9007199254740735.