Variable-Length Integer Encoding defined by RFC 9000
npm install quicvarint!License
![crates.io][npm]
[npm]: https://www.npmjs.com/package/quicvarint
Variable-Length Integer Encoding defined by RFC 9000.
* Features
* Usage
* Security Considerations
* License
* Decode a 2-MSB varint from a DataView or a Uint8Array
* Encode a 2-MSB varint to a Uint8Array
* Support integer between 0 and 2147483647 included
* TypeScript types
``typescript
import { encode, decode, MAX } from "quicvarint"
// A number between 0 and MAX
const n = 1234
// Encode it to a Uint8Array
const encN = encode(n)
// Decode it and print it on console
console.log(decode(encN))
``
This software has not been audited. Please use at your sole discretion.
This project is under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be MIT licensed as above, without any additional terms or conditions.