{"name":"avsc","version":"6.0.0-alpha.15","keywords":["api","avdl","avpr","avro","avsc","binary","buffer","data","decoding","encoding","idl","interface","ipc","json","marshalling","message","protocol","rpc","schema","serde","serialization","type"],"author":{"name":"Matthieu Monsch","email":"mtth@apache.org"},"license":"MIT","_id":"avsc@6.0.0-alpha.15","maintainers":[{"name":"mtth","email":"mtth@apache.org"}],"homepage":"https://github.com/mtth/avsc","bugs":{"url":"https://github.com/mtth/avsc/issues"},"dist":{"shasum":"46544c6df98b878af8830471d064d5c6ba47d3a5","tarball":"http://registry-npm.ywwl.com/avsc/download/avsc-6.0.0-alpha.15.tgz","fileCount":16,"integrity":"sha512-1Umi1+m6mUf/Ouqb/E7C6o2Uf+zMt6OzlOcAO5MKrgrwAPj4csx1B9skNmygu9rN/fO6HCv6dK9VIUxBWjR6uw==","signatures":[{"sig":"MEQCIEXgxm+fYOSLLXSxEEBIzKW7XnZBxogB+aMspff+kB+mAiA1v4k4IrSVbZHicjxWcd1UErOMyqoUM4Fzb3FcX2sYQg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":190861,"size":50331,"noattachment":false,"key":"/avsc/-/avsc-6.0.0-alpha.15.tgz"},"main":"./lib","types":"./types","browser":{"./lib":"./etc/browser/avsc.js","./lib/files":"./etc/browser/lib/files.js","./lib/platform":"./etc/browser/lib/platform.js"},"engines":{"node":">=6.0.0"},"gitHead":"be5a1b35a1186566daf7f24f07311bc86a14ed78","scripts":{"lint":"eslint etc/ lib/ test/ \"etc/scripts/**\"","perf":"node --expose-gc ./etc/scripts/perf etc/schemas/*","test":"mocha --ui tdd --reporter dot","clean":"rm -rf coverage node_modules","cover":"nyc mocha -- --ui tdd","check-types":"tsc --strict --noEmit types/test/*.ts"},"_npmUser":{"name":"mtth","email":"mtth@apache.org"},"repository":{"url":"git://github.com/mtth/avsc.git","type":"git"},"_npmVersion":"10.9.0","description":"Avro for JavaScript","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"~15.0.0","tmp":"^0.1.0","mocha":"^10.2.0","eslint":"^8.30.0","benchmark":"~2.1.4","typescript":"^5.6.2","@types/node":"^22.5.5"},"_npmOperationalInternal":{"tmp":"tmp/avsc_6.0.0-alpha.15_1729433584865_0.2930749269984385","host":"s3://npm-registry-packages"},"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":1729433585056,"_cnpm_publish_time":1729433585056,"dist-tags":{"alpha":"6.0.0-alpha.15","latest":"5.7.9"}}