{"name":"protocol-buffers-encodings","version":"1.2.0","description":"Base encodings for protocol-buffers","main":"index.js","dependencies":{"b4a":"^1.6.0","signed-varint":"^2.0.1","varint":"5.0.0"},"devDependencies":{"standard":"^14.3.4","tape":"^5.0.1"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/protocol-buffers-encodings.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/protocol-buffers-encodings/issues"},"homepage":"https://github.com/mafintosh/protocol-buffers-encodings","gitHead":"59bc47d9c5cae4bda1dcb5db92c30f56bbe65d70","_id":"protocol-buffers-encodings@1.2.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-daeNPuKh1NlLD1uDfbLpD+xyUTc07nEtfHwmBZmt/vH0B7VOM+JOCOpDcx9ZRpqHjAiIkGqyTDi+wfGSl17R9w==","shasum":"39900b85dcff3172a23f15bdf3fda70daa2b38d3","tarball":"http://registry-npm.ywwl.com/protocol-buffers-encodings/download/protocol-buffers-encodings-1.2.0.tgz","fileCount":6,"unpackedSize":14407,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB4Ux0ZvaUFRQ3JqVcU6if2/NVg83qEnUPbyofwLXt3JAiAeDKLeNHxaRQL4coo5UDBo6DVgDK8y+R/yE8pbRG9PBA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi6WU4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpIcg/+KmzRc12Kpv6fcjDo5DpmUoaIqRH3w46sIbSVyzasouECeJ8W\r\nxNIUspBF80lN5OUcbpnIdd5CEkubPsUIumHIBWkHr0iBDoq7pY99TgR8/06o\r\nvVRf9Aij94ySQRT+5YOLy1w1e9a+UH8qQa1mMM1/ECw9iquXl4rGG/5kBC8c\r\nF2nc+07mbRI60gRZM5H/lipHSSW/bjDrX5zVCJFH+CvwL3Z5Wvgq/o8csIRq\r\nRMVQseCzwwFu89Kf5fvu80zV8Hz3vjTUEMVxl+DLqVX83IQYrPWbdWmFNO07\r\nwDM93siYxmU8VjedcN33Zn9KkO71k1oil3qzQ80EbogOo+e+LZHQ4YQcE/po\r\n9SrCpATfGGmwwIHlAkVsknNLNQQbk17twyrTTDsFuttq03pZyljTOTzhr8H3\r\nKfiwLZPKLbQ76disdaesjRtt/rj6g4gVemnXP/eKFq09kbuRLy2OWptX+hBo\r\nSQlWTf6iwH3RSOcKbaq6yjZZwjhawbMe4z60AzZH1a5hj0avEBKKLhJOJ1fS\r\nKkAsZbsjtJyEC+u1CIjldKKt2kcVfh71TyeFLuWt5yHG9mWSuSoTfdT4kvJC\r\nCA5eSEAbQv4wW8hetPdTh5+MSoblkQE+fqiW2qnPt/8bB6DwGou4KWoFHAma\r\nAuvbDbghLdWhwtmlvimM0xToMV6vK0DmEz8=\r\n=XRZ+\r\n-----END PGP SIGNATURE-----\r\n","size":3994,"noattachment":false,"key":"/protocol-buffers-encodings/-/protocol-buffers-encodings-1.2.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/protocol-buffers-encodings_1.2.0_1659462968697_0.5356515523497922"},"_hasShrinkwrap":false,"readme":"# protocol-buffers-encodings\n\nBase encodings for [protocol-buffers](https://github.com/mafintosh/protocol-buffers).\n\n```\nnpm install protocol-buffers-encodings\n```\n\nNote: use Node.js >= 16.15.0 to avoid a performance regression due to a slower `Buffer.subarray` function.\n\n[![build status](https://travis-ci.org/mafintosh/protocol-buffers-encodings.svg?branch=master)](https://travis-ci.org/mafintosh/protocol-buffers-encodings)\n\nMoved into its own module for lighter installs\n\n## Usage\n\n``` js\nvar encodings = require('protocol-buffers-encodings')\nvar buf = Buffer.alloc(4096)\n\nencodings.string('hi', buf, 0)\nconsole.log(encodings.string(buf, 0)) // prints 'hi'\n```\n\n## API\n\nIn general all encoders follow this API\n\n#### `buffer = enc.encode(value, buffer, offset)`\n\nEncode a value. `buffer` should be a buffer big enough to fit the value, `offset` should be the byte offset in the buffer where you want to write it.\nThe buffer is returned for convenience.\n\nAfter a value has been encoded `enc.encode.bytes` contains the amount of bytes used in the buffer.\n\n#### `value = enc.decode(buffer, offset)`\n\nDecode a value. `buffer` should be an encoded value and `offset` should be the byte offset where you want to start decoding.\n\nAfter a value has been decoded `enc.decode.bytes` contains the amount of bytes that was consumed from the buffer.\n\n#### `var len = enc.encodingLength(value)`\n\nUse this method to calculate how much space is needed to encode a value.\n\n#### `enc.type`\n\nA number indicating the protobuf wire type for the encoding\n\n## Encodings\n\nThe following encodings are available\n\n* `encodings.bytes` - encode a buffer\n* `encodings.string` - encode a string\n* `encodings.bool` - encode a boolean\n* `encodings.uint64` - encode a uint64 to varint\n* `encodings.uint32` - encode a uint32 to varint\n* `encodings.sint64` - encode a signed int64 to a signed varint\n* `encodings.sint32` - encode a signed int32 to a signed varint\n* `encodings.int64` - encode a signed int64 to a varint\n* `encodings.int32` - encode a signed int32 to a varint\n* `encodings.fixed32` - encode a uint32 to a fixed 4 byte buffer\n* `encodings.sfixed32` - encode a signed int32 to a fixed 4 byte buffer\n* `encodings.fixed64` - encode a uint64 (represented as a buffer) to a fixed 8 byte buffer\n* `encodings.sfixed64` - encode a signed int64 (represented as a buffer) to a fixed 8 byte buffer\n* `encodings.double` - encode a double\n* `encodings.float` - encode a float\n* `encodings.enum` - encode a numeric enum as a varint\n\n## License\n\nMIT\n","publish_time":1659462968903,"_cnpm_publish_time":1659462968903,"dist-tags":{"latest":"1.2.0"}}