{"name":"borc","version":"2.1.0","description":"Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049).","main":"./src/index.js","repository":{"type":"git","url":"git+https://github.com/dignifiedquire/borc.git"},"homepage":"https://github.com/dignifiedquire/borc.git","browser":{"fs":false},"scripts":{"test":"aegir test --files test/**/*.spec.js","test:browser":"aegir test --target browser","test:node":"aegir test --target node","lint":"aegir lint","docs":"aegir docs","release":"aegir release --docs","release-minor":"aegir release --type minor","release-major":"aegir release --type major","build":"aegir build","coverage":"aegir coverage","coverage-publish":"aegir coverage --upload","bench":"node benchmarks/index.js","bench-browser":"budo benchmarks/index.js"},"keywords":["coap","cbor","json","asm","asm.js"],"author":{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},"devDependencies":{"aegir":"^18.0.1","benchmark":"^2.1.0","budo":"^11.2.0","cbor":"^4.0.0","chai":"^4.1.2","dirty-chai":"^2.0.1","garbage":"0.0.0"},"license":"MIT","dependencies":{"bignumber.js":"^8.0.1","commander":"^2.15.0","ieee754":"^1.1.8","iso-url":"~0.4.4","json-text-sequence":"~0.1.0"},"engines":{"node":">=4"},"contributors":[{"name":"Benjamin Cabé","email":"kartben@gmail.com"},{"name":"Dan Finlay","email":"542863+danfinlay@users.noreply.github.com"},{"name":"Hugo Dias","email":"mail@hugodias.me"},{"name":"Joe Hildebrand","email":"joe-github@cursive.net"},{"name":"Joe Hildebrand","email":"joe+github@cursive.net"},{"name":"Patrick Gansterer","email":"paroga@paroga.com"},{"name":"Ryan Pendergast","email":"ryan.pendergast@gmail.com"},{"name":"Rüdiger Klaehn","email":"rklaehn@gmail.com"},{"name":"Scorpi","email":"cobblebone@gmail.com"},{"name":"Tobias Wich","email":"tobias.wich@ecsec.de"},{"name":"dignifiedquire","email":"dignifiedquire@users.noreply.github.com"},{"name":"dignifiedquire","email":"dignifiedquire@gmail.com"},{"name":"greenkeeperio-bot","email":"support@greenkeeper.io"}],"gitHead":"b14a3176cc2851185320c33ccaa0020746beacab","bugs":{"url":"https://github.com/dignifiedquire/borc/issues"},"_id":"borc@2.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"dignifiedquire","email":"dignifiedquire@gmail.com"},"dist":{"integrity":"sha512-hKTxeYt3AIzIG45epJHv8xJYSF0ktp7nZgFsqi5cPzoL3T8qKMPeUlqydORy6j3NWZvRDANx30PjpTmGho69Gw==","shasum":"2def2fc69868633b965a9750e7f210d778190303","tarball":"http://registry-npm.ywwl.com/borc/download/borc-2.1.0.tgz","fileCount":32,"unpackedSize":1585967,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcLfEmCRA9TVsSAnZWagAAbXUQAIv+Q87UrCrcv7M9o6JE\nETCWRhrG6O7eCwbREGacK8PSMteZRAHtlm0ejP76+CXeoD8ss2kdnRVOLsF4\nyMNIx4i9KEvhvIp7D1QrY9bIIUw21xry7VW52WagpIOvHEnw+UaCPbSp45EL\nLD1Qe/Z4S7mYZYT7wMqrhcxxjM8PWsNwgngOoZX0yIXdCkAot7VThhPqQOay\nqNTasCtrfKbLbjs93sTnptHe93JMWLUHxXbJq2nU6Nt+QCUUYXP3IKMM+h4K\nG76TWhkSK2LP7jHV5JoHAaaLHzjXjAb+ORFOtkRdGrLbdUgz7/aqVu/pJT+W\nHS3KkiW/ByRhe2TN4F1qkrhqx4pTko1d/5oK4GuLEakA0l2zhHntuZ0eY8fg\nrLZEIvQ8rurG+pxRFDzC0FmNkMwUvO+O2QgLllHh0cFFSBIMd/4kFHocyuWc\n89e2AS8Ocbj1VQnP8uF5wEgrvN7zlRgGLvkjSpx6wTxnFP4tzJWrcdmPjX+c\nYWrMmQVEltGep26hGH1i5e7DAK5ZwBX0tEJ1Py0ByxpphOw9rayLdXdmSRnW\nSzbt3c/1Bab194+mWMO5zq0Y9eJ0+I46WBHXbvfRgkXXqlZ9FmvgdRRVOGgW\nOyYCi71sTQbjYB+SmMWhO9IdnAS8GqZWgWWfXmJUPCht2TTsmX8ogs39TiNZ\nSc/p\r\n=Deo3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBQdbnK/Za+IsCAa+P1BT+bE76Bt3Z838qLeSm4lv5CUAiEAlvwDVnVqxgfTRTseO00KCdm5vVFUTIGOkiBcPgPrsLA="}],"size":441311,"noattachment":false,"key":"/borc/-/borc-2.1.0.tgz"},"maintainers":[{"name":"daviddias","email":"daviddias.p@gmail.com"},{"name":"dignifiedquire","email":"dignifiedquire@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/borc_2.1.0_1546514725585_0.23155940543790154"},"_hasShrinkwrap":false,"readme":"# borc\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Coverage Status](https://coveralls.io/repos/github/dignifiedquire/borc/badge.svg?branch=master)](https://coveralls.io/github/dignifiedquire/borc?branch=master)\n[![Dependency Status](https://david-dm.org/dignifiedquire/borc.svg?style=flat-square)](https://david-dm.org/dignifiedquire/borc)\n[![Travis CI](https://travis-ci.org/dignifiedquire/borc.svg?branch=master)](https://travis-ci.org/dignifiedquire/borc)\n\n\n> Assimilate all your JavaScript objects into the Concise Binary Object Representation (CBOR) data format ([RFC7049](http://tools.ietf.org/html/rfc7049)) **as fast as possible**.\n\n\n## About\n\nThis library is a fork of the awesome [node-cbor](https://github.com/hildjj/node-cbor). It borrows a lot of the interface, but drops all streaming and async processing in favor of a minimal syn api and being as fast as possible.\n\n\n## Installation\n\n```bash\n$ npm install --save borc\n```\n\n## Benchmarks\n\nTODO\n\n## Example\n\n```javascript\nconst cbor = require('borc')\nconst assert = require('assert')\n\nconst encoded = cbor.encode(true) // returns <Buffer f5>\nconst decoded = cbor.decodeFirst(encoded)\n// decoded is the unpacked object\nassert.ok(decoded === true)\n\n// Use integers as keys\nvar m = new Map()\nm.set(1, 2)\nencoded = cbor.encode(m) // <Buffer a1 01 02>\n```\n\n## API\n\nSee https://dignifiedquire.github.io/borc for details\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## 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.URL\n* [bignumber](https://github.com/MikeMcl/bignumber.js)\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   | bignumber      |\n| 3   | bignumber      |\n| 4   | bignumber      |\n| 5   | bignumber      |\n| 32  | url.URL        |\n| 35  | RegExp         |\n\n\n## Customizations\n\nBorc supports custom tags as well as custom input types.\n\n### Encode Custom Types\n\n```js\nclass MyType {\n  constructor (val) {\n    this.val = val\n  }\n\n  // Gets called when encoding this object\n  // gen - instance of the encoder\n  // obj - the object being encoded\n  //\n  // should return true on success and false otherwise\n  encodeCBOR (gen) {\n    return gen.pushAny('mytype:' + this.val)\n  }\n}\n\ncbor.encode([new MyType('hello')])\n```\n\n### Encode Custom Tags\n\n```js\ncbor.encode([new cbor.Tagged(42, 'hello')])\n```\n\n### Decode Custom Tags\n\n```js\nconst decoder = new cbor.Decoder({\n  tags: {\n    42: (val) => val + ' world'\n  }\n})\n```\n\n## License\n\nMIT\n","publish_time":1546514725746,"_cnpm_publish_time":1546514725746,"dist-tags":{"latest":"3.0.0"}}