{"name":"varint","version":"5.0.2","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":"fbcfa76d7633053aa75d58f26f9e03b12bdfd792","bugs":{"url":"https://github.com/chrisdickinson/varint/issues"},"homepage":"https://github.com/chrisdickinson/varint#readme","_id":"varint@5.0.2","_nodeVersion":"14.9.0","_npmVersion":"6.14.8","_npmUser":{"name":"chrisdickinson","email":"chris@neversaw.us"},"dist":{"integrity":"sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==","shasum":"5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4","tarball":"http://registry-npm.ywwl.com/varint/download/varint-5.0.2.tgz","fileCount":8,"unpackedSize":9027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfchg+CRA9TVsSAnZWagAArisQAIY80yGPmeZ73ye+Zuyc\nhtFKhG1I/KUCE42itLWdxrlTWhJ+cStYhcHBCtNl/+0WUIzmSIPcgR8Fbewp\nFD5CZlDcVmBI+geTucFrqLxJPHuL6xrWRtznjmtEKoqKXCyIgmZPoIuFbDoi\nw5um8a7ZyIDdwOZviJtl4hUiGPe5U5AbgRszAy5m+1G+WfzLa/SO0s6J57P2\nKps4IGcTkEpc5pciFzzBf4dZvg7Z0Ld35eyF7E8qgRfYIGEndwfTquW7ujOI\nIkVCUBL9EQgYKsbKFKDyyEKfZ6t1dkMzPP5r17EYYMcA1MnexogKmqSmzYVM\nqlNAzUmMAmDb0LCAktWcRdWT9n3wZMYKQ4kbMpnAAcDmzc/pg9UEAo2QNMtl\n/vqTQq0CKbRvNCcejYRtf2ZqrAOAJRkZWrLCFhP22q2K3eQWwsnQAtjsYV+V\nA3JjeV/2Q10f272l1m7U7IVPgqIBS+vzX3fZyNlYaMQybN0RzJG3Su9nW8dI\nINNy0ZFiu6DYz/S/3IP5tTth1IUIjGwE1T1Ka+qw1Uln+tg9jJBCJdGku4WO\naTJYfhvi8KCR32gCkhmPAUKfh6/C2EVtqruHShGxcl7qc+aY+s9kplxa0roH\n/iqxoC/cdIJkK6p3bjkhrnMXEK85C9m/xNok1yOPckj9Ss6j1vv5u9uRAKqT\nM5gg\r\n=YReK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGmGRJAJIj14u/u3zrJOzLEGIAWkQ3rzdqe4aIX5Lc+/AiAreDQWVtMf2BicJsT48S9x06QI1LAvK6dmq7g8mJv+1Q=="}],"size":3502,"noattachment":false,"key":"/varint/-/varint-5.0.2.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.2_1601312830410_0.6799392829517643"},"_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":1601312830538,"_cnpm_publish_time":1601312830538,"dist-tags":{"latest":"6.0.0"}}