{"name":"varint","version":"6.0.0","description":"protobuf-style varint bytes - use msb to create integer values of varying sizes","main":"index.js","scripts":{"test":"node test.js"},"repository":{"type":"git","url":"git://github.com/chrisdickinson/varint.git"},"keywords":["varint","protobuf","encode","decode"],"author":{"name":"Chris Dickinson","email":"chris@neversaw.us"},"license":"MIT","devDependencies":{"tape":"~2.12.3"},"gitHead":"7fc8829334c20c4c0e246e3b473c1eb1c03ebbf9","bugs":{"url":"https://github.com/chrisdickinson/varint/issues"},"homepage":"https://github.com/chrisdickinson/varint#readme","_id":"varint@6.0.0","_nodeVersion":"14.9.0","_npmVersion":"6.14.8","_npmUser":{"name":"chrisdickinson","email":"chris@neversaw.us"},"dist":{"integrity":"sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==","shasum":"9881eb0ce8feaea6512439d19ddf84bf551661d0","tarball":"http://registry-npm.ywwl.com/varint/download/varint-6.0.0.tgz","fileCount":8,"unpackedSize":9616,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfchjOCRA9TVsSAnZWagAAgDkP/1PDrf+EeDIbs+Ovkmwt\nbe7r/SlJzQosbKltxSh/btBnGUgUUQMvSv179/K/uM+17kiyOeV/eXtJni9Q\nlVB4UUZQWSpFKmXzv1larZZ0IZC28L2zBZNmr1WcvhvXddFEPwMlEmUQz0/r\nmB3/dLLD7yh8NB1Sjd8rD0hy8caNtRQVuvsgDQ72ihl296N3agARGnLIt9St\ndOGRwMxOtvEaENqtsu21QlS5l+x/rZz/ZytdP5/Q5gKzmetJv+DU65sqtznz\nWH/vZWOgC901jf5SD3X2iG97jw1WT6wIYNqetI8S0X2K7fzEZplH3jiFKAeD\nmSY3xM7NLbg+qIMUuWdQ89DipPonr/C3xrcklEfD/0RuQP/6z1YW70OA77MC\nyvw/cs0cZauCH7OPE3VxUtV8OxKaqJPTcoZ7vVb1E3dOUwcyI26cyqBs+y6e\nvn64vFO6R8Dr5VT7YdkBkNs6GjTdBNCAjYB6H3L/dyQH37ANE4fsPnsQAJUY\n1Qs94spS/W8FSKCNLUfkBq7qkivENRdRD/sIFMDQTdZOS5nKKpYZD0U8n+xq\n+rDzf47QlgwhoWy8Ju9PbZeYP+9ImNqbtZgwY5B4onFrvm8GYjHhKUjbby6c\n5j7hnm6poENDFn8Rhmmki8Hf1ideS60+Rrj9OXI5e+wUYXlvmrtZK8POYWQF\nvkKd\r\n=/aRE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGuQU0tAcf1ka7eqT/GP52wOK/UuNEnaQerNm4sZK3NZAiBNWrZWcz8DrJTKu6S25Q5ccQ1R5rrhYbeKDxR7QOLXhQ=="}],"size":3674,"noattachment":false,"key":"/varint/-/varint-6.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"chrisdickinson","email":"chris@neversaw.us"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/varint_6.0.0_1601312974278_0.8589756219092359"},"_hasShrinkwrap":false,"readme":"# varint\n\nencode whole numbers to an array of [protobuf-style varint bytes](https://developers.google.com/protocol-buffers/docs/encoding#varints) and also decode them.\n\n```javascript\nvar varint = require('varint')\n\nvar bytes = varint.encode(300) // === [0xAC, 0x02]\nvarint.decode(bytes) // 300\nvarint.decode.bytes // 2 (the last decode() call required 2 bytes)\n```\n\n## api\n\n### varint = require('varint')\n\n### varint.encode(num[, buffer=[], offset=0]) -> buffer\n\nEncodes `num` into `buffer` starting at `offset`. returns `buffer`, with the encoded varint written into it. If `buffer` is not provided, it will default to a new array.\n\n`varint.encode.bytes` will now be set to the number of bytes\nmodified.\n\n### varint.decode(data[, offset=0]) -> number\n\ndecodes `data`, which can be either a buffer or array of integers, from position `offset` or default 0 and returns the decoded original integer.\n\nThrows a `RangeError` when `data` does not represent a valid encoding.\n\n### varint.decode.bytes\n\nif you also require the length (number of bytes) that were required to decode the integer you can access it via `varint.decode.bytes`. this is an integer property that will tell you the number of bytes that the last .decode() call had to use to decode.\n\n### varint.encode.bytes\n\nsimilar to `decode.bytes` when encoding a number it can be useful to know how many bytes where written (especially if you pass an output array). you can access this via `varint.encode.bytes` which holds the number of bytes written in the last encode.\n\n\n### varint.encodingLength(num)\n\nreturns the number of bytes this number will be encoded as, up to a maximum of 8.\n\n## usage notes\n\nIf varint is passed a buffer that does not contain a valid end\nbyte, then `decode` will throw `RangeError`, and `decode.bytes` \nwill be set to 0. If you are reading from a streaming source,\nit's okay to pass an incomplete buffer into `decode`, detect this\ncase, and then concatenate the next buffer.\n\n# License\n\nMIT\n","publish_time":1601312974401,"_cnpm_publish_time":1601312974401,"dist-tags":{"latest":"6.0.0"}}