{"name":"@ipld/dag-cbor","version":"7.0.1","keywords":["ipfs","ipld","multiformats"],"author":{"url":"http://r.va.gg/","name":"Rod","email":"rod@vagg.org"},"license":"(Apache-2.0 AND MIT)","_id":"@ipld/dag-cbor@7.0.1","homepage":"https://github.com/ipld/js-dag-cbor#readme","bugs":{"url":"https://github.com/ipld/js-dag-cbor/issues"},"dist":{"shasum":"d46c6bbb9afa55c74a85d0117b4ab389ceb9083b","tarball":"http://registry-npm.ywwl.com/@ipld/dag-cbor/download/@ipld/dag-cbor-7.0.1.tgz","fileCount":15,"integrity":"sha512-XqG8VEzHjQDC/Qcy5Gyf1kvAav5VuAugc6c7VtdaRLI+3d8lJrUP3F76GYJNNXuEnRZ58cCBnNNglkIGTdg1+A==","signatures":[{"sig":"MEUCICYBAoNwelue/jfk4kkDa3AP6KKDVn1UUj6V7bJC0ewTAiEA1rSFjoPGT8jA3nkNI3FTCu7hqOhV1jzd5cgG+8mwqiw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48090,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHsiSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/HQ//UQTr3Jva547D4ZxiR4iOFQ8yYayYv2wykDH/lfPcPOSNWiyZ\r\nSG7PvdzCCYEPRRogj9HmOm/+hyvVwp06Sl5I4C9vo0vINJkAzjxQt9sSrEo5\r\n6qs6xqHGGC8tvfd9bMI61X7qPjJnA5bqrVusErz1u+6OBDjrD9C2FNojaLl+\r\n5vQcw1OZlC34M3zsvbjW6img3rEkCSjZPexMdvH4I+9QyXIiawswxcqFihBX\r\nMuJ1X2Rfc0wrTGy+TYuFaO1S1bpIdvHjqEwUoSMy7fwuOSw5k4QCJkp78luC\r\nn+NaFGHrJS6KmDXKgPklsJKP4cNW6e3g2VpvCmsnVfN2isbkknTqIig6kxqG\r\nbYZjvI1kGQrAti8F4kGNPvPYhwtKnNvJHmCdWMOBfVG2T7fO2JR6/oe7J05D\r\nFrsSUvGod2z/U6nFLNqeCSjFCtxR7H5WN1uZ0q34J2cye8HN6zfnCMrM2wu4\r\n1568k7yulTB1zm4sXIrYjfq8mrDtyEJ0xLIJzUx3EVtCuoEE5mgIX0Kekj9s\r\n83McxReba8Q/9dKpL2K/aWfIcT+53JtsaGzouKBnP74BEZRE2IH8F/Uq3PEW\r\nli6lTrIvphxse+IHMuZGuSQ9suIyPgD5s/WuOTNmxbZfb29Iq5S8xIuYR1qJ\r\naarE5pH7kFeHlfUn1ZD7b+qt2Umcx5UQ+YI=\r\n=pvJ4\r\n-----END PGP SIGNATURE-----\r\n","size":7885,"noattachment":false,"key":"/@ipld/dag-cbor/-/@ipld/dag-cbor-7.0.1.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"},"gitHead":"b34bf67543c91975d0afe051e50fa1d6eb66a35a","release":{"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"release":"major","breaking":true},{"revert":true,"release":"patch"},{"type":"feat","release":"minor"},{"type":"fix","release":"patch"},{"type":"chore","release":"patch"},{"type":"docs","release":"patch"},{"type":"test","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Trivial Changes"},{"type":"docs","section":"Trivial Changes"},{"type":"test","section":"Tests"}]}}],"@semantic-release/changelog",["@semantic-release/npm",{"pkgRoot":"dist"}],"@semantic-release/github","@semantic-release/git"],"branches":["master"]},"scripts":{"lint":"standard *.js test/*.js","test":"npm run lint && npm run test:node && npm run test:esm && npm run test:ts","build":"npm run build:js && npm run build:types","test:ci":"npm run lint && npm run test:node && npm run test:esm && npm run test:cjs && npm run test:ts","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:esm":"npm run build:js && mocha dist/esm/node-test/test-*.js && npm run test:esm:browser","test:node":"c8 --check-coverage --branches 100 --functions 100 --lines 100 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/browser-test/test-*.js","test:esm:browser":"polendina --page --worker --serviceworker --cleanup dist/esm/browser-test/test-*.js"},"_npmUser":{"name":"rvagg","email":"r@va.gg"},"standard":{"ignore":["dist"]},"repository":{"url":"git+https://github.com/ipld/js-dag-cbor.git","type":"git"},"_npmVersion":"8.5.2","description":"JS implementation of DAG-CBOR","directories":{"test":"test"},"_nodeVersion":"14.19.0","dependencies":{"cborg":"^1.6.0","multiformats":"^9.5.4"},"typesVersions":{"*":{"*":["types/*"],"types/*":["types/*"]}},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.10.0","chai":"^4.3.4","ipjs":"^5.2.0","mocha":"^9.1.3","buffer":"^6.0.3","standard":"^16.0.4","polendina":"~2.0.1","typescript":"~4.6.2","ipld-garbage":"^4.0.10"},"_npmOperationalInternal":{"tmp":"tmp/dag-cbor_7.0.1_1646184594055_0.5866977087788796","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":1646184594206,"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":1646184594206,"dist-tags":{"latest":"10.0.2"}}