{"name":"@ipld/dag-cbor","version":"6.0.0","keywords":["IPFS","IPLD"],"author":{"url":"https://www.mikealrogers.com/","name":"Mikeal Rogers","email":"mikeal.rogers@gmail.com"},"license":"(Apache-2.0 AND MIT)","_id":"@ipld/dag-cbor@6.0.0","homepage":"https://github.com/ipld/js-dag-cbor","bugs":{"url":"https://github.com/ipld/js-dag-cbor/issues"},"dist":{"shasum":"6611cad413b6465fed1bf13adcd46b24f05db2a3","tarball":"http://registry-npm.ywwl.com/@ipld/dag-cbor/download/@ipld/dag-cbor-6.0.0.tgz","fileCount":15,"integrity":"sha512-jJSEO+n0LrWRV+2f/8ctR8vg89wvA0yDBd+ulHRchllmHmZ3RytXXSLdU0t5H7hC462TgSgPAigFn/AMTfpG0Q==","signatures":[{"sig":"MEQCICP7HQm8LsFpkPSk2olcq3TvOM2WoGxDLZhpQrOGKg8dAiA0dH2iZa5U0xN+K4mCqd1XEKBj3Tf1o5Z15vfgS4mjHA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45167,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgr17lCRA9TVsSAnZWagAAUloQAJS4jXO6gz5E/TKXzDZA\nf/OOZmCw8Eusnb1EnecWunZmUeE06Q7ymRdAfzOe8YdQsxla3e92gmfYorW3\nQlqqtoT27O1vsMcjGfBzBjB9ESNyBmnAwyMZaaZv8OUpwvFYSh2jdaXpFP3u\n1e07nsgbeTEaTXeHiFZwmAvk23vvu4neWqgJABsyxmfaF/QPF0mItGrqoQVj\nE8DusqtQ89eb2vU19Bvfd9x5OTHbAl6HuebXl11s6O/On0LD/Dv/zXtFPwFi\nHK3V4MAAucA3Z/TLWzZVEs9oLhL0ICB/G12FbU3PHk2KR0qr7uWHxVWrr7tm\nfuMLRRi8TkzZEo5k7v2B7TKA2VkiOkquegjo7XtRNKxLF9KJGBsnzUzp9sv8\nYP7VG60xOBrUIg3eBWYW8d5Oe6yGRVcYHMaCNchqah4S9Veu0ysLNRS8X+YP\nzygslxHEkrOzG+nt0L8yVnIVdVqCS6dfc/EUenpVliPTONBotb5LNq5Rmeji\n4WaKORbMEV2hoE4DLRSgtIeY6iwrUO0+JNaUyLh/u9dBI9o5DMMvcvJbtFLm\nIpi4DQDAN8tTDYOCHL2nWXEerna1FrePCOxiWbIPPXg5LHgkaXk1XtybKK8g\n/jeByv+00ea92slwnLnXWFBtjL/v0mtT636CZfBNIY4iJM7jI3iuGk2EvvFn\nW1ND\r\n=wHWL\r\n-----END PGP SIGNATURE-----\r\n","size":7512,"noattachment":false,"key":"/@ipld/dag-cbor/-/@ipld/dag-cbor-6.0.0.tgz"},"main":"./cjs/index.js","types":"./types/index.d.ts","browser":"./cjs/index.js","exports":{"import":"./esm/index.js","browser":"./esm/index.js","require":"./cjs/index.js"},"scripts":{"lint":"standard *.js test/*.js","test":"npm run lint && npm run test:node && npm run test:cjs && npm run test:ts","build":"npm run build:js && npm run build:types","publish":"ipjs publish","test:ts":"npm run build:types && npm run test --prefix test/ts-use","build:js":"ipjs build --tests --main && npm run build:copy","coverage":"c8 --reporter=html mocha test/test-*.js && npm_config_yes=true npx st -d coverage -p 8080","test:cjs":"npm run build:js && mocha dist/cjs/node-test/test-*.js && npm run test:cjs:browser","test:node":"hundreds mocha test/test-*.js","build:copy":"cp -a tsconfig.json index.js dist/ && mkdir -p dist/test && cp test/*.js dist/test/","build:types":"npm run build:copy && cd dist && tsc --build","test:cjs:browser":"polendina --page --worker --serviceworker --cleanup dist/cjs/node-test/test-*.js"},"_npmUser":{"name":"mikeal","email":"mikeal.rogers@gmail.com"},"repository":{"url":"git+https://github.com/ipld/js-dag-cbor.git","type":"git"},"_npmVersion":"6.14.12","description":"JS implementation of DAG-CBOR","directories":{"test":"test"},"_nodeVersion":"12.22.1","dependencies":{"cborg":"^1.2.1","multiformats":"^9.0.0"},"typesVersions":{"*":{"*":["types/*"],"types/*":["types/*"]}},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","ipjs":"^5.0.0","mocha":"^8.3.2","hundreds":"^0.0.9","standard":"^16.0.3","polendina":"^1.1.0","typescript":"^4.2.4","ipld-garbage":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/dag-cbor_6.0.0_1622105829396_0.6060323790609452","host":"s3://npm-registry-packages"},"readme":"# @ipld/dag-cbor <!-- omit in toc -->\n\n[![codecov](https://img.shields.io/codecov/c/github/ipld/js-dag-cbor.svg?style=flat-square)](https://codecov.io/gh/ipld/js-dag-cbor)\n[![CI](https://img.shields.io/github/workflow/status/ipld/js-dag-cbor/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipld/js-dag-cbor/actions/workflows/js-test-and-release.yml)\n\n> JS implementation of DAG-CBOR\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Spec](#spec)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i @ipld/dag-cbor\n```\n\nThis is the *new* interface meant for use by itself or with `multiformats` and\n`@ipld/block`. It is not used by `js-ipld-format` which is currently\nused in IPFS. That library is [here](https://github.com/ipld/js-ipld-dag-cbor).\n\nUsage:\n\n```javascript\nimport { encode, decode } from '@ipld/dag-cbor'\nimport { CID } from 'multiformats'\n\nconst obj = {\n  x: 1,\n  /* CID instances are encoded as links */\n  y: [2, 3, CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4')],\n  z: {\n    a: CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'),\n    b: null,\n    c: 'string'\n  }\n}\n\nlet data = encode(obj)\nlet decoded = decode(data)\ndecoded.y[0] // 2\nCID.asCID(decoded.z.a) // cid instance\n\n// encode/decode options are exported for use with cborg's encodedLength and decodeFirst\nimport { encodeOptions, decodeOptions } from '@ipld/dag-cbor'\nimport { encodedLength } from 'cborg/length'\nimport { decodeFirst } from 'cborg'\n\n// dag-cbor encoded length of obj in bytes\nconst byteLength = encodedLength(obj, encodeOptions)\nbyteLength // 104\n\n// concatenate two dag-cbor encoded obj\nconst concatenatedData = new Uint8Array(data.length * 2)\nconcatenatedData.set(data)\nconcatenatedData.set(data, data.length)\n\n// returns dag-cbor decoded obj at the beginning of the buffer as well as the remaining bytes\nconst [first, remainder] = decodeFirst(concatenatedData, decodeOptions)\nassert.deepStrictEqual(first, obj)\nassert.deepStrictEqual(remainder, data)\n```\n\n## Spec\n\nThe [`dag-cbor` specification is in the IPLD specs repo](https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-cbor.md).\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","publish_time":1622105829577,"maintainers":[{"name":"npm-service-account-ipld","email":"npm-service-account+ipld@ipfs.tech"},{"name":"lidel","email":"lidel@lidel.org"},{"name":"alanshaw","email":"alan138@gmail.com"},{"name":"vascosantos","email":"santos.vasco10@gmail.com"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"rvagg","email":"r@va.gg"},{"name":"daviddias","email":"mail@daviddias.me"},{"name":"mikeal","email":"mikeal.rogers@gmail.com"},{"name":"vmx","email":"volker.mische@gmail.com"}],"_cnpm_publish_time":1622105829577,"dist-tags":{"latest":"10.0.2"}}