{"name":"varint","version":"5.0.1","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":"1198bb822373447bd95f0556b2e141b264aec964","bugs":{"url":"https://github.com/chrisdickinson/varint/issues"},"homepage":"https://github.com/chrisdickinson/varint#readme","_id":"varint@5.0.1","_nodeVersion":"14.9.0","_npmVersion":"6.14.8","_npmUser":{"name":"chrisdickinson","email":"chris@neversaw.us"},"dist":{"integrity":"sha512-nd1E35rKooOyDPhAeHS3hWVrTRBP4Cpn86Zxg/G73C9vA4Un2RXn9pvPF3SVOvTALCDL9wFSCwfI5ENAPzLWDA==","shasum":"d65c148f4c3bddc8201297474873a324d266a1dd","tarball":"http://registry-npm.ywwl.com/varint/download/varint-5.0.1.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\nwsFcBAEBCAAQBQJfcS6jCRA9TVsSAnZWagAAITAP/RW60OPBOp04vE8+TZL/\n+BwLB2scNYppdZd9YvBPEpkYsWTvpcx/Ns5I7k8q4tnIJZH6ZHc+UpLbMojR\nCfvVlVT467A6vAiD4/0Z7P8vsyKYxQgzj1iv/rEFdDlZnDn/IQs7uxk3ZDo3\n6h+nLyzSvtrDIWE1mvjuzviRK3M9+4XFgJ2d7H58oyqS8T2bMB3GAJTJXVow\naxXxfm8S6tJf/me/KHltsdBcpc2/HxGxzGNrT36kOvwwI6GKMFk6tIXmxQWC\n+BHFk2/utVNCki/lN1MBr7XTCC0gQHdLkxpN3/a5KCFWkkwOKvWzVQBt+xq/\nd7X1SXx06rZaj8nxESyvYUUg+Zf6JdBpT7I5TiEKCxJqEseXtBXsRbgTDsmd\nZ9pa30DxHyVDX+Meqi4YvBU88lJrQ1dekaXHMs//fehI4Pr1PU/yZcewvhxx\n+9EAQVOWUR4GKmqeKEuwXIu+nJZzQAd3OQAVG74y5WFxH7aiCw2lTrMCWDvz\nh/9zcjxu72Icrx3JRnN154H/bLPMa2CB5ABWrgJsRurBjw447nxQv9u8Chzr\nduWGDCu+nN6J8KG4VCP3DRI1yQ2SnbZoUNDqcJdUBgn1aJO8sv2jMA2dXkMx\navk/5YK8YcdQSxj3yTYXhghQ3NUOaoMQ0AczfMQplCudsRg4+uajOrMpIevr\nNxLp\r\n=P8Ao\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAuVYNNS1furzhNj7UR/I1xBDffInNMNX+DvYEmZ8RJmAiEA5No3pb05cNEUlRm0YkpqqeIIwoYmlOKfqQpV9eQhJhs="}],"size":3672,"noattachment":false,"key":"/varint/-/varint-5.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"chrisdickinson","email":"chris@neversaw.us"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/varint_5.0.1_1601253026768_0.6037396201690917"},"_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":1601253026910,"_cnpm_publish_time":1601253026910,"dist-tags":{"latest":"6.0.0"}}