{"name":"avsc","version":"5.7.9","description":"Avro for JavaScript","homepage":"https://github.com/mtth/avsc","keywords":["api","avdl","avpr","avro","avsc","binary","buffer","data","decoding","encoding","idl","interface","ipc","json","marshalling","message","protocol","rpc","schema","serde","serialization","type"],"main":"./lib","types":"./types","browser":{"./lib":"./etc/browser/avsc.js","./lib/files":"./etc/browser/lib/files.js","crypto":"./etc/browser/lib/crypto.js"},"engines":{"node":">=0.11"},"scripts":{"clean":"rm -rf coverage dist node_modules","cover":"nyc mocha -- --ui tdd","coverAndPublish":"nyc npm test && nyc report --reporter=text-lcov | coveralls","dist":"./etc/scripts/dist","perf":"./etc/scripts/perf etc/schemas/*","test":"mocha --ui tdd --reporter dot"},"devDependencies":{"benchmark":"~2.1.4","coveralls":"^3.0.9","mocha":"^8.1.1","nyc":"~15.0.0","tmp":"^0.1.0"},"author":{"name":"Matthieu Monsch","email":"mtth@apache.org"},"license":"MIT","repository":{"type":"git","url":"git://github.com/mtth/avsc.git"},"_id":"avsc@5.7.9","gitHead":"f44546ac9b91795c5845278b8bcea5e47fe67707","bugs":{"url":"https://github.com/mtth/avsc/issues"},"_nodeVersion":"24.4.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-yOA4wFeI7ET3v32Di/sUybQ+ttP20JHSW3mxLuNGeO0uD6PPcvLrIQXSvy/rhJOWU5JrYh7U4OHplWMmtAtjMg==","shasum":"8532cd47b2fbff95be4bc470c6780c258d86680a","tarball":"http://registry-npm.ywwl.com/avsc/download/avsc-5.7.9.tgz","fileCount":17,"unpackedSize":264000,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHIKej2Zxqf9SqPmSLc0sWpCu+SjepTqTyEv3hgrXf+bAiEAh+LPSfiAu3+z0A0cQ7sF40XbYA2ut+Be5UlX76rCC/0="}],"size":68159,"noattachment":false,"key":"/avsc/-/avsc-5.7.9.tgz"},"_npmUser":{"name":"mtth","email":"mtth@apache.org"},"directories":{},"maintainers":[{"name":"mtth","email":"mtth@apache.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/avsc_5.7.9_1752446093662_0.8656789155451039"},"_hasShrinkwrap":false,"readme":"# Avsc [![NPM version](https://img.shields.io/npm/v/avsc.svg)](https://www.npmjs.com/package/avsc) [![Download count](https://img.shields.io/npm/dm/avsc.svg)](https://www.npmjs.com/package/avsc) [![CI](https://github.com/mtth/avsc/actions/workflows/ci.yml/badge.svg)](https://github.com/mtth/avsc/actions/workflows/ci.yml) [![Coverage status](https://coveralls.io/repos/mtth/avsc/badge.svg?branch=master&service=github)](https://coveralls.io/github/mtth/avsc?branch=master)\n\nPure JavaScript implementation of the [Avro\nspecification](https://avro.apache.org/docs/current/spec.html).\n\n\n## Features\n\n+ Blazingly [fast and compact][benchmarks] serialization! Typically faster than\n  JSON with much smaller encodings.\n+ All the Avro goodness and more: [type inference][type-inference], [schema\n  evolution][schema-evolution], and [remote procedure calls][rpc].\n+ Support for [serializing arbitrary JavaScript objects][logical-types].\n+ Unopinionated [64-bit integer compatibility][custom-long].\n\n\n## Installation\n\n```sh\n$ npm install avsc\n```\n\n`avsc` is compatible with all versions of [node.js][] since `0.11`.\n\n\n## Documentation\n\n+ [Home][home]\n+ [API](https://github.com/mtth/avsc/wiki/API)\n+ [Quickstart](https://github.com/mtth/avsc/wiki/Quickstart)\n+ [Advanced usage](https://github.com/mtth/avsc/wiki/Advanced-usage)\n+ [Benchmarks][benchmarks]\n\n\n## Examples\n\nInside a node.js module, or using browserify:\n\n```javascript\nconst avro = require('avsc');\n```\n\n+ Encode and decode values from a known schema:\n\n  ```javascript\n  const type = avro.Type.forSchema({\n    type: 'record',\n    name: 'Pet',\n    fields: [\n      {\n        name: 'kind',\n        type: {type: 'enum', name: 'PetKind', symbols: ['CAT', 'DOG']}\n      },\n      {name: 'name', type: 'string'}\n    ]\n  });\n\n  const buf = type.toBuffer({kind: 'CAT', name: 'Albert'}); // Encoded buffer.\n  const val = type.fromBuffer(buf); // = {kind: 'CAT', name: 'Albert'}\n  ```\n\n+ Infer a value's schema and encode similar values:\n\n  ```javascript\n  const type = avro.Type.forValue({\n    city: 'Cambridge',\n    zipCodes: ['02138', '02139'],\n    visits: 2\n  });\n\n  // We can use `type` to encode any values with the same structure:\n  const bufs = [\n    type.toBuffer({city: 'Seattle', zipCodes: ['98101'], visits: 3}),\n    type.toBuffer({city: 'NYC', zipCodes: [], visits: 0})\n  ];\n  ```\n\n+ Get a [readable stream][readable-stream] of decoded values from an Avro\n  container file compressed using [Snappy][snappy] (see the [`BlockDecoder`\n  API][decoder-api] for an example including checksum validation):\n\n  ```javascript\n  const snappy = require('snappy'); // Or your favorite Snappy library.\n  const codecs = {\n    snappy: function (buf, cb) {\n      // Avro appends checksums to compressed blocks, which we skip here.\n      return snappy.uncompress(buf.slice(0, buf.length - 4), cb);\n    }\n  };\n\n  avro.createFileDecoder('./values.avro', {codecs})\n    .on('metadata', function (type) { /* `type` is the writer's type. */ })\n    .on('data', function (val) { /* Do something with the decoded value. */ });\n  ```\n\n+ Implement a TCP server for an [IDL-defined][idl] protocol:\n\n  ```javascript\n  // We first generate a protocol from its IDL specification.\n  const protocol = avro.readProtocol(`\n    protocol LengthService {\n      /** Endpoint which returns the length of the input string. */\n      int stringLength(string str);\n    }\n  `);\n\n  // We then create a corresponding server, implementing our endpoint.\n  const server = avro.Service.forProtocol(protocol)\n    .createServer()\n    .onStringLength(function (str, cb) { cb(null, str.length); });\n\n  // Finally, we use our server to respond to incoming TCP connections!\n  require('net').createServer()\n    .on('connection', (con) => { server.createChannel(con); })\n    .listen(24950);\n  ```\n\n\n[benchmarks]: https://github.com/mtth/avsc/wiki/Benchmarks\n[browser-support]: https://github.com/mtth/avsc/wiki#browser-support\n[custom-long]: https://github.com/mtth/avsc/wiki/Advanced-usage#custom-long-types\n[decoder-api]: https://github.com/mtth/avsc/wiki/API#class-blockdecoderopts\n[home]: https://github.com/mtth/avsc/wiki\n[idl]: https://avro.apache.org/docs/current/idl.html\n[logical-types]: https://github.com/mtth/avsc/wiki/Advanced-usage#logical-types\n[node.js]: https://nodejs.org/en/\n[readable-stream]: https://nodejs.org/api/stream.html#stream_class_stream_readable\n[rpc]: https://github.com/mtth/avsc/wiki/Quickstart#services\n[schema-evolution]: https://github.com/mtth/avsc/wiki/Advanced-usage#schema-evolution\n[snappy]: https://avro.apache.org/docs/current/spec.html#snappy\n[type-inference]: https://github.com/mtth/avsc/wiki/Advanced-usage#type-inference\n","publish_time":1752446093832,"_cnpm_publish_time":1752446093832,"dist-tags":{"alpha":"6.0.0-alpha.15","latest":"5.7.9"}}