{"_id":"@zondax/cbor","_rev":"7-d90089b0d28e9a3855462a6ed24856eb","name":"@zondax/cbor","dist-tags":{"latest":"8.1.0-zondax-no-bigint"},"versions":{"8.1.0-zondax":{"name":"@zondax/cbor","version":"8.1.0-zondax","keywords":["coap","cbor","json","rfc7049","rfc8949"],"author":{"name":"Joe Hildebrand","email":"joe-github@cursive.net"},"license":"MIT","_id":"@zondax/cbor@8.1.0-zondax","maintainers":[{"name":"carlosala","email":"carlosalag@protonmail.com"},{"name":"jleni","email":"juan.leni@zondax.ch"}],"contributors":[{"url":"http://paroga.com/","name":"Patrick Gansterer","email":"paroga@paroga.com"},{"url":"http://scorpi.org/","name":"Artyom Yagilev","email":"github@scorpi.org"},{"url":"http://lapaev.me/","name":"Denis Lapaev","email":"den@lapaev.me"},{"name":"Ruben Bridgewater","email":"ruben@bridgewater.de"},{"name":"Burt Harris","email":"Burt_Harris_cbor@azxs.33mail.com"},{"url":"https://jakubarbet.me/","name":"Jakub Arbet","email":"hi@jakubarbet.me"}],"homepage":"https://github.com/hildjj/node-cbor/tree/main/packages/cbor","bugs":{"url":"https://github.com/hildjj/node-cbor/issues"},"dist":{"shasum":"231601af7744de1a011a0c787a1309948cad3f90","tarball":"https://registry.npmjs.org/@zondax/cbor/-/cbor-8.1.0-zondax.tgz","fileCount":26,"integrity":"sha512-1YT3sa6FYfpr7Xwy/87j90qlbeCst/W0Z0g0lGbUGJiCl6UOLXfc1i5nQiqvNebDe8BMlihht7YNi5dS0dVIdQ==","signatures":[{"sig":"MEYCIQCWiLZvI2Qfcw3fVH0bveAmHCEmtYDnbSTnvRUIp/ps9gIhAONkvP6PRuIV6DFi1UOnV2BnVDxVxJrhSVD/w2dzpFE6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":154289,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi9nskACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqC2A/+MEwjJSdV10QoHiIMUOIG0TH7H0N723cOruTx0KK1Rse1/dFD\r\nxHuND+LMkldXnJeCRrpYTTEV08Ga3sKdq65n/WesuAp61WamNQR7DrDF9hoz\r\n2+JcNpwmOduTmKcJ/O0IIOi49/TxboXngrI1dxS8lG4G/E9MObUeX2bzyshB\r\nQf2Z2vzqhRYbWle3sukcHHXM3n2VlijvijSOlwahmZ1mGaL3wPaZ6EyxPP3c\r\nHYBJth22navMJzD+VsK49P0IrDxJOU9pkjYP9FVYIS84T+wVLNzav0mci2E3\r\n5g/tORDnS8VPK+Jk2vhqwE9+tMAB4G6Y90IvDoZpP5ak+vHHXf/XyZal8D5u\r\n/D4OMX73oSyy+lqVflWEJmyBUiHmOOR5fJuCRI1WyMLslLe85uroRZpXW3ed\r\nMYhVFW1tujgwG7w2UIRmJyRD4zGzMfsHYwCgywxo5jNrn2DKxf7NtVFi3YeK\r\nR4wHtLSZKr7EOnLbm0euJORUkEcl9PEM96+CgIeAMO80e0yz+uw+XcSmQGqK\r\n3JUari1oGvDuGYmwCxqCXiGrNJ8SO48ZPay1enuhpwkGp/TmyOlTQ3cy56sh\r\n1ihhsl0KGmBnLWzQYAKntHETRb2mmb5AF46RnhHb48x6x3QH2GiiemB93TQw\r\nWtE/zxULPnh4N653g762L2JslRgBn8uNiXY=\r\n=QKPV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/cbor.js","types":"./types/lib/cbor.d.ts","browser":{"fs":false},"engines":{"node":">=12.19"},"gitHead":"bfc1fc818550b9bfa3d6ae6604427c7bd1324f4a","scripts":{"dev":"light-server -q -s. -w 'lib/*.js,test/*.js # npm run coverage' -o /coverage/lcov-report/index.html","lint":"eslint lib/*.js test/*.js","test":"ava test/*.ava.js","clean":"rimraf coverage .nyc_output/ docs","types":"tsc","predev":"npm run coverage","release":"npm version patch && git push --follow-tags && npm publish","coverage":"nyc -r lcov npm test"},"_npmUser":{"name":"jleni","email":"juan.leni@zondax.ch"},"repository":{"url":"git+ssh://git@github.com/hildjj/node-cbor.git","type":"git","directory":"packages/cbor"},"_npmVersion":"8.1.0","description":"Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC8949).","directories":{"lib":"lib"},"_nodeVersion":"16.13.0","dependencies":{"nofilter":"^3.1.0","big-integer":"^1.6.51"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^3.0.2","garbage":"~0.0.0","p-event":"^4.2.0","@types/node":"*","bignumber.js":"^9.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cbor_8.1.0-zondax_1660320547409_0.6004245468749103","host":"s3://npm-registry-packages"}},"8.1.0-no-bigint":{"name":"@zondax/cbor","version":"8.1.0-no-bigint","keywords":["coap","cbor","json","rfc7049","rfc8949"],"author":{"name":"Joe Hildebrand","email":"joe-github@cursive.net"},"license":"MIT","_id":"@zondax/cbor@8.1.0-no-bigint","maintainers":[{"name":"ftheirs","email":"fernando@zondax.ch"},{"name":"carlosala","email":"carlosalag@protonmail.com"},{"name":"jleni","email":"juan.leni@zondax.ch"}],"contributors":[{"url":"http://paroga.com/","name":"Patrick Gansterer","email":"paroga@paroga.com"},{"url":"http://scorpi.org/","name":"Artyom Yagilev","email":"github@scorpi.org"},{"url":"http://lapaev.me/","name":"Denis Lapaev","email":"den@lapaev.me"},{"name":"Ruben Bridgewater","email":"ruben@bridgewater.de"},{"name":"Burt Harris","email":"Burt_Harris_cbor@azxs.33mail.com"},{"url":"https://jakubarbet.me/","name":"Jakub Arbet","email":"hi@jakubarbet.me"}],"homepage":"https://github.com/hildjj/node-cbor/tree/main/packages/cbor","bugs":{"url":"https://github.com/hildjj/node-cbor/issues"},"dist":{"shasum":"544cd973705dfe85af9819db564e7674e36bb799","tarball":"https://registry.npmjs.org/@zondax/cbor/-/cbor-8.1.0-no-bigint.tgz","fileCount":26,"integrity":"sha512-okpdF5NVdXLaj0nUYH32WUkped4HESa+5mhca0GAdkf+mZTxdtZNq7dzGQwLBrUm5+YCJphdYl9k2aA+waMDlA==","signatures":[{"sig":"MEQCIA2Svd0ZwHX4OocgOIbc/A1b3GiwQqWLC4OvCHo1jRZFAiBgnf3bOToa3r1FiqbNiW3WPG/UugD0VHabo2VzuYd46A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":154026,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/CgpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9SQ//fZDtfmvFUGUXzgl17IQ5cam+M3NMQKqnIkfLUx7NLHRROuzK\r\nASxRGzGI1UJ317k+6yoExtFZ3NnsxtHio3D3+JgCprzyxf+5hILgzbI4jwGe\r\nojPBSoOpnIlIpyvMxGcaEzqpAjdDQY7ATZLJ345Hnf2n+TCQSTFje3Ynseg1\r\nUUzcDIwG6H+jKUj4Ar79VXGuluV3TKQAmcYqV6fUOs7gNndBcPFfbXcCmzLT\r\nzw+h4pVhcXdJyvw6bxzArpye3L5xN13k6RdQXByYPqPHwB1RK8qE+uDVMCKw\r\nNnJDQQ2oqsGJLEMiOzV5YqFkFMuKrLhtSBgdXJQoeFra+6mXS4Bx9py0SSQu\r\nIzSrBS1Rn7XdV+qLpCutFy2SpNjnWbPYUX/K3R9uZM1I8rBsR/xU8RibjbJN\r\nmmnQCNTrgPW80weUHAWD6B0AX+ZBMGRxT2jeQ0HgIBBEzww7WhjY6vBzJRoH\r\ng42oteietzHVRGyL8/2H54DCG55+vnD7PXA33Zh+bjmFzU5PTdUeEjunp7ni\r\n6905sjQnQJvKJOMWlZ/jv42NcM9vIF/AYQn4FBHt8N9yNwReKYqcFD7im5/9\r\nuj4NdyLc/fV4WROuT6eGarcifM26FNDFsFZQc2Mi8CBf/8FhnluQkgyz0X3I\r\n1+6fKOkTMBFXFx4Hgiaehm+cs16QIiDkgVc=\r\n=G0xf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/cbor.js","types":"./types/lib/cbor.d.ts","browser":{"fs":false},"engines":{"node":">=12.19"},"gitHead":"ba86a606ece782dd6d21796316a023365ccd249b","scripts":{"dev":"light-server -q -s. -w 'lib/*.js,test/*.js # npm run coverage' -o /coverage/lcov-report/index.html","lint":"eslint lib/*.js test/*.js","test":"ava test/*.ava.js","clean":"rimraf coverage .nyc_output/ docs","types":"tsc","predev":"npm run coverage","release":"npm version patch && git push --follow-tags && npm publish","coverage":"nyc -r lcov npm test"},"_npmUser":{"name":"jleni","email":"juan.leni@zondax.ch"},"repository":{"url":"git+ssh://git@github.com/hildjj/node-cbor.git","type":"git","directory":"packages/cbor"},"_npmVersion":"8.1.0","description":"Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC8949).","directories":{"lib":"lib"},"_nodeVersion":"16.13.0","dependencies":{"nofilter":"^3.1.0","big-integer":"^1.6.51"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^3.0.2","garbage":"~0.0.0","p-event":"^4.2.0","@types/node":"*","bignumber.js":"^9.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cbor_8.1.0-no-bigint_1660692521254_0.33258004631764204","host":"s3://npm-registry-packages"}},"8.1.0-zondax-no-bigint":{"name":"@zondax/cbor","version":"8.1.0-zondax-no-bigint","keywords":["coap","cbor","json","rfc7049","rfc8949"],"author":{"name":"Joe Hildebrand","email":"joe-github@cursive.net"},"license":"MIT","_id":"@zondax/cbor@8.1.0-zondax-no-bigint","maintainers":[{"name":"ftheirs","email":"fernando@zondax.ch"},{"name":"carlosala","email":"carlosalag@protonmail.com"},{"name":"jleni","email":"juan.leni@zondax.ch"}],"contributors":[{"url":"http://paroga.com/","name":"Patrick Gansterer","email":"paroga@paroga.com"},{"url":"http://scorpi.org/","name":"Artyom Yagilev","email":"github@scorpi.org"},{"url":"http://lapaev.me/","name":"Denis Lapaev","email":"den@lapaev.me"},{"name":"Ruben Bridgewater","email":"ruben@bridgewater.de"},{"name":"Burt Harris","email":"Burt_Harris_cbor@azxs.33mail.com"},{"url":"https://jakubarbet.me/","name":"Jakub Arbet","email":"hi@jakubarbet.me"}],"homepage":"https://github.com/hildjj/node-cbor/tree/main/packages/cbor","bugs":{"url":"https://github.com/hildjj/node-cbor/issues"},"dist":{"shasum":"95aec1751fb8548306a22b5434592ec0fc116e8f","tarball":"https://registry.npmjs.org/@zondax/cbor/-/cbor-8.1.0-zondax-no-bigint.tgz","fileCount":27,"integrity":"sha512-dFjJxSIZH2aaiG35iIUqKr3OXnZwy1XVYP5yx78UJP7ftOBxmN3OWX8k+pt4I2l/gjYONW/XMkG+RtTkxvFzlw==","signatures":[{"sig":"MEUCIENfET9aQSSuY3WJoXOCl8dp9/A5u8JsGeTy5PeujVb4AiEA5pwKgQ7KcehGD1FOU2xXp+GUwjp9Y7ZH0VP0QtB7B8c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":154369,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/Ne+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpN9A/9H4FlWRF2ZiF5uPbL9I39hDvwSMIcTDLwMET/NqwfoSrqw0w9\r\nzhWQetFFQBF0h8hM8Ie7DNUrH8KKElbsIVmthTov3H2HA1MhdtMBdhhq/5qJ\r\nNM9cmlqjTWZk+QzHfJuhOy0K+IlrIFFDAIIbYvcGckBbpD7vrOKxahrsjLPX\r\n3ogyxhvk7xxUOh/EqLC1QSso2tMywkM70RQPqPnkVKRRwJI18lPIBAAZO21z\r\nJ/8Qzbh1muMpVFwFhB0JmW8I/XoTLo0SZBK/NL9oLkc46ddOrrCn5DrqtAlJ\r\n3SWXUDcL7cu1SQdZf1xYD8qpTYDn0s/PJhOk5LnEIC8OLo3NS7bpL33kdGmT\r\nHObVKVZnFazW/TCs+/47FljSuD45c5XlIYL0+UatkkwVt4a/kLRj7uKfGNkf\r\noGOOaB6l+ch9g1Qd7hU5pwb5Mp6I4xDa93Jgnxsze4yx+yo21GeZV5/Yn6nO\r\nHljF5lzO4YsU+YbwXrGi57X/joKpbxEJLuDS2RiAhNaGZpoeA5rARcG86k+v\r\nMAb7qfhsdTt8RbP0OEEGcPJeaTjQKgzgF3mYJi2+uupsTz0yax+DecX95YYq\r\n/t0VZToDtFGeZnTnnIqVf9F8833OS96wCh6nfPOwlCWJk+c9Fqz9ghtxDSqP\r\nui21OPKbx6OaaKB6BbV2ROrjMAbra5pndq4=\r\n=00af\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/cbor.js","types":"./types/lib/cbor.d.ts","browser":{"fs":false},"engines":{"node":">=12.19"},"gitHead":"17ce60ef467f4faebfedbab90634a281218a45bb","scripts":{"dev":"light-server -q -s. -w 'lib/*.js,test/*.js # npm run coverage' -o /coverage/lcov-report/index.html","lint":"eslint lib/*.js test/*.js","test":"ava test/*.ava.js","clean":"rimraf coverage .nyc_output/ docs","types":"tsc","predev":"npm run coverage","release":"npm version patch && git push --follow-tags && npm publish","coverage":"nyc -r lcov npm test"},"_npmUser":{"name":"jleni","email":"juan.leni@zondax.ch"},"repository":{"url":"git+ssh://git@github.com/hildjj/node-cbor.git","type":"git","directory":"packages/cbor"},"_npmVersion":"8.1.0","description":"Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC8949).","directories":{"lib":"lib"},"_nodeVersion":"16.13.0","dependencies":{"nofilter":"^3.1.0","big-integer":"^1.6.51"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^3.0.2","garbage":"~0.0.0","p-event":"^4.2.0","@types/node":"*","bignumber.js":"^9.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cbor_8.1.0-zondax-no-bigint_1660737470664_0.5229071163703225","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-08-12T16:09:07.342Z","modified":"2025-12-17T11:56:31.690Z","8.1.0-zondax":"2022-08-12T16:09:08.169Z","8.1.0-no-bigint":"2022-08-16T23:28:41.478Z","8.1.0-zondax-no-bigint":"2022-08-17T11:57:50.899Z"},"bugs":{"url":"https://github.com/hildjj/node-cbor/issues"},"author":{"name":"Joe Hildebrand","email":"joe-github@cursive.net"},"license":"MIT","homepage":"https://github.com/hildjj/node-cbor/tree/main/packages/cbor","keywords":["coap","cbor","json","rfc7049","rfc8949"],"repository":{"url":"git+ssh://git@github.com/hildjj/node-cbor.git","type":"git","directory":"packages/cbor"},"description":"Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC8949).","contributors":[{"url":"http://paroga.com/","name":"Patrick Gansterer","email":"paroga@paroga.com"},{"url":"http://scorpi.org/","name":"Artyom Yagilev","email":"github@scorpi.org"},{"url":"http://lapaev.me/","name":"Denis Lapaev","email":"den@lapaev.me"},{"name":"Ruben Bridgewater","email":"ruben@bridgewater.de"},{"name":"Burt Harris","email":"Burt_Harris_cbor@azxs.33mail.com"},{"url":"https://jakubarbet.me/","name":"Jakub Arbet","email":"hi@jakubarbet.me"}],"maintainers":[{"email":"juan.leni@zondax.ch","name":"jleni"},{"email":"emmanuel@zondax.ch","name":"emmanuel-zondax"}],"readme":"# cbor\n\nEncode and parse data in the Concise Binary Object Representation (CBOR) data format ([RFC8949](https://www.rfc-editor.org/rfc/rfc8949.html)).\n\n## Supported Node.js versions\n\nThis project now only supports versions of Node that the Node team is\n[currently supporting](https://github.com/nodejs/Release#release-schedule).\nAva's [support\nstatement](https://github.com/avajs/ava/blob/main/docs/support-statement.md)\nis what we will be using as well.  Currently, that means Node `10`+ is\nrequired.  If you need to support an older version of Node (back to version\n6), use cbor version 5.2.x, which will get nothing but security updates from\nhere on out.\n\n## Installation:\n\n```bash\n$ npm install --save cbor\n```\n\n**NOTE**\nIf you are going to use this on the web, use [cbor-web](../cbor-web) instead.\n\nIf you need support for encoding and decoding BigDecimal fractions (tag 4) or\nBigFloats (tag 5), please see [cbor-bigdecimal](../cbor-bigdecimal).\n\n## Documentation:\n\nSee the full API [documentation](http://hildjj.github.io/node-cbor/).\n\nFor a command-line interface, see [cbor-cli](../cbor-cli).\n\nExample:\n```js\nconst cbor = require('cbor')\nconst assert = require('assert')\n\nlet encoded = cbor.encode(true) // Returns <Buffer f5>\ncbor.decodeFirst(encoded, (error, obj) => {\n  // If there was an error, error != null\n  // obj is the unpacked object\n  assert.ok(obj === true)\n})\n\n// Use integers as keys?\nconst m = new Map()\nm.set(1, 2)\nencoded = cbor.encode(m) // <Buffer a1 01 02>\n```\n\nAllows streaming as well:\n\n```js\nconst cbor = require('cbor')\nconst fs = require('fs')\n\nconst d = new cbor.Decoder()\nd.on('data', obj => {\n  console.log(obj)\n})\n\nconst s = fs.createReadStream('foo')\ns.pipe(d)\n\nconst d2 = new cbor.Decoder({input: '00', encoding: 'hex'})\nd.on('data', obj => {\n  console.log(obj)\n})\n```\n\nThere is also support for synchronous decodes:\n\n```js\ntry {\n  console.log(cbor.decodeFirstSync('02')) // 2\n  console.log(cbor.decodeAllSync('0202')) // [2, 2]\n} catch (e) {\n  // Throws on invalid input\n}\n```\n\nThe sync encoding and decoding are exported as a\n[leveldb encoding](https://github.com/Level/levelup#custom_encodings), as\n`cbor.leveldb`.\n\n## highWaterMark\n\nThe synchronous routines for encoding and decoding will have problems with\nobjects that are larger than 16kB, which the default buffer size for Node\nstreams.  There are a few ways to fix this:\n\n1) pass in a `highWaterMark` option with the value of the largest buffer size you think you will need:\n\n```js\ncbor.encodeOne(new ArrayBuffer(40000), {highWaterMark: 65535})\n```\n\n2) use stream mode.  Catch the `data`, `finish`, and `error` events.  Make sure to call `end()` when you're done.\n\n```js\nconst enc = new cbor.Encoder()\nenc.on('data', buf => /* Send the data somewhere */ null)\nenc.on('error', console.error)\nenc.on('finish', () => /* Tell the consumer we are finished */ null)\n\nenc.end(['foo', 1, false])\n```\n\n3) use `encodeAsync()`, which uses the approach from approach 2 to return a memory-inefficient promise for a Buffer.\n\n## Supported types\n\nThe following types are supported for encoding:\n\n* boolean\n* number (including -0, NaN, and ±Infinity)\n* string\n* Array, Set (encoded as Array)\n* Object (including null), Map\n* undefined\n* Buffer\n* Date,\n* RegExp\n* URL\n* TypedArrays, ArrayBuffer, DataView\n* Map, Set\n* BigInt\n\nDecoding supports the above types, including the following CBOR tag numbers:\n\n| Tag | Generated Type      |\n|-----|---------------------|\n| 0   | Date                |\n| 1   | Date                |\n| 2   | BigInt              |\n| 3   | BigInt              |\n| 21  | Tagged, with toJSON |\n| 22  | Tagged, with toJSON |\n| 23  | Tagged, with toJSON |\n| 32  | URL                 |\n| 33  | Tagged              |\n| 34  | Tagged              |\n| 35  | RegExp              |\n| 64  | Uint8Array          |\n| 65  | Uint16Array         |\n| 66  | Uint32Array         |\n| 67  | BigUint64Array      |\n| 68  | Uint8ClampedArray   |\n| 69  | Uint16Array         |\n| 70  | Uint32Array         |\n| 71  | BigUint64Array      |\n| 72  | Int8Array           |\n| 73  | Int16Array          |\n| 74  | Int32Array          |\n| 75  | BigInt64Array       |\n| 77  | Int16Array          |\n| 78  | Int32Array          |\n| 79  | BigInt64Array       |\n| 81  | Float32Array        |\n| 82  | Float64Array        |\n| 85  | Float32Array        |\n| 86  | Float64Array        |\n| 258 | Set                 |\n\n## Adding new Encoders\n\nThere are several ways to add a new encoder:\n\n### `encodeCBOR` method\n\nThis is the easiest approach, if you can modify the class being encoded.  Add an\n`encodeCBOR` method to your class, which takes a single parameter of the encoder\ncurrently being used.  Your method should return `true` on success, else `false`.\nYour method may call `encoder.push(buffer)` or `encoder.pushAny(any)` as needed.\n\nFor example:\n\n```js\nclass Foo {\n  constructor() {\n    this.one = 1\n    this.two = 2\n  }\n\n  encodeCBOR(encoder) {\n    const tagged = new Tagged(64000, [this.one, this.two])\n    return encoder.pushAny(tagged)\n  }\n}\n```\n\nYou can also modify an existing type by monkey-patching an `encodeCBOR` function\nonto its prototype, but this isn't recommended.\n\n### `addSemanticType`\n\nSometimes, you want to support an existing type without modification to that\ntype.  In this case, call `addSemanticType(type, encodeFunction)` on an existing\n`Encoder` instance. The `encodeFunction` takes an encoder and an object to\nencode, for example:\n\n```js\nclass Bar {\n  constructor() {\n    this.three = 3\n  }\n}\nconst enc = new Encoder()\nenc.addSemanticType(Bar, (encoder, b) => {\n  encoder.pushAny(b.three)\n})\n```\n\n## Adding new decoders\n\nMost of the time, you will want to add support for decoding a new tag type.  If\nthe Decoder class encounters a tag it doesn't support, it will generate a `Tagged`\ninstance that you can handle or ignore as needed.  To have a specific type\ngenerated instead, pass a `tags` option to the `Decoder`'s constructor, consisting\nof an object with tag number keys and function values.  The function will be\npassed the decoded value associated with the tag, and should return the decoded\nvalue.  For the `Foo` example above, this might look like:\n\n```js\nconst d = new Decoder({\n  tags: {\n    64000: val => {\n      // Check val to make sure it's an Array as expected, etc.\n      const foo = new Foo()\n      ;[foo.one, foo.two] = val\n      return foo\n    },\n  },\n})\n```\n\nYou can also replace the default decoders by passing in an appropriate tag\nfunction.  For example:\n\n```js\ncbor.decodeFirstSync(input, {\n  tags: {\n    // Replace the Tag 0 (RFC3339 Date/Time string) decoder.\n    // See https://tc39.es/proposal-temporal/docs/ for the upcoming\n    // Temporal built-in, which supports nanosecond time:\n    0: x => Temporal.Instant.from(x),\n  },\n})\n```\n\nDevelopers\n----------\n\nThe tests for this package use a set of test vectors from RFC 8949 appendix A\nby importing a machine readable version of them from\nhttps://github.com/cbor/test-vectors. For these tests to work, you will need\nto use the command `git submodule update --init` after cloning or pulling this\ncode.   See https://gist.github.com/gitaarik/8735255#file-git_submodules-md\nfor more information.\n\nGet a list of build steps with `npm run`.  I use `npm run dev`, which rebuilds,\nruns tests, and refreshes a browser window with coverage metrics every time I\nsave a `.js` file.  If you don't want to run the fuzz tests every time, set\na `NO_GARBAGE` environment variable:\n\n```\nenv NO_GARBAGE=1 npm run dev\n```\n\n[![Build Status](https://github.com/hildjj/node-cbor/workflows/Tests/badge.svg)](https://github.com/hildjj/node-cbor/actions?query=workflow%3ATests)\n[![Coverage Status](https://coveralls.io/repos/hildjj/node-cbor/badge.svg?branch=main)](https://coveralls.io/r/hildjj/node-cbor?branch=main)\n","readmeFilename":"README.md"}