{"name":"ipld-dag-cbor","version":"0.8.4","description":"JavaScript implementation of the IPLD (InterpPlanetary Linked Data)","main":"src/index.js","scripts":{"test":"aegir-test","test:browser":"aegir-test --env browser","test:node":"aegir-test --env node","lint":"aegir-lint","release":"aegir-release","release-minor":"aegir-release --type minor","release-major":"aegir-release --type major","build":"aegir-build","coverage":"aegir-coverage","coverage-publish":"aegir-coverage publish"},"pre-commit":["lint","test"],"repository":{"type":"git","url":"git+https://github.com/ipld/js-ipld-dag-cbor.git"},"keywords":["IPFS"],"author":{"name":"David Dias","email":"daviddias@ipfs.io"},"license":"MIT","bugs":{"url":"https://github.com/ipld/js-ipld-dag-cbor/issues"},"engines":{"node":">=4.0.0"},"homepage":"https://github.com/ipld/js-ipld-dag-cbor","dependencies":{"async":"^2.1.4","borc":"^2.0.1","bs58":"^4.0.0","cids":"^0.4.0","multihashes":"^0.3.2","multihashing-async":"^0.4.0","traverse":"^0.6.6"},"devDependencies":{"aegir":"^9.4.0","chai":"^3.5.0","ipfs-block":"^0.5.4","pre-commit":"^1.2.2"},"contributors":[{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Yusef Napora","email":"yusef@napora.org"},{"name":"greenkeeper[bot]","email":"greenkeeper[bot]@users.noreply.github.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"wanderer","email":"mjbecze@gmail.com"}],"gitHead":"c12eda57d509aa6357be1d70ab51916300da37ac","_id":"ipld-dag-cbor@0.8.4","_shasum":"233f4a3205fe43ae7600f22ad0daa613eb4f953b","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"daviddias","email":"daviddias.p@gmail.com"},"dist":{"shasum":"233f4a3205fe43ae7600f22ad0daa613eb4f953b","tarball":"http://registry-npm.ywwl.com/ipld-dag-cbor/download/ipld-dag-cbor-0.8.4.tgz","integrity":"sha512-YuBIDlk1bsi9glDkjhWMPrDpJggVjKPz8gjDhn2zQSPP29bW0rob/3mabDJ1jGaIHnaLffmIv/Fs+RQlNFuSDg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF07XyDermdvYFyG0RPO7tTJihfGzXQM5SvxFU0oonnyAiEAzaWQQjh0+LnOJCusVN/91ugL8aHEh/FLhnuyc4l/9dA="}],"size":236827,"noattachment":false,"key":"/ipld-dag-cbor/-/ipld-dag-cbor-0.8.4.tgz"},"maintainers":[{"name":"daviddias","email":"daviddias.p@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ipld-dag-cbor-0.8.4.tgz_1485709011225_0.9470976064912975"},"directories":{},"deprecated":"This module has been superseded by @ipld/dag-cbor and multiformats","readme":"⛔️ DEPRECATED: This module has been superseded by [@ipld/dag-cbor](https://github.com/ipld/js-dag-cbor) and [multiformats](https://github.com/multiformats/js-multiformats) <!-- omit in toc -->\n======\n\n# js-ipld-dag-cbor <!-- omit in toc -->\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-IPLD-blue.svg?style=flat-square)](http://github.com/ipld/ipld)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipld/js-ipld-dag-cbor)](https://travis-ci.com/ipld/js-ipld-dag-cbor)\n[![Coverage](https://coveralls.io/repos/github/ipld/js-ipld-dag-cbor/badge.svg?branch=master)](https://coveralls.io/github/ipld/js-ipld-dag-cbor?branch=master)\n[![](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n[![](https://david-dm.org/ipld/js-ipld-dag-cbor.svg?style=flat-square)](https://david-dm.org/ipld/js-ipld-dag-cbor)\n[![](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n[![Greenkeeper badge](https://badges.greenkeeper.io/ipld/js-ipld-dag-cbor.svg)](https://greenkeeper.io/)\n![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)\n![](https://img.shields.io/badge/Node.js-%3E%3D6.0.0-orange.svg?style=flat-square)\n\n> JavaScript implementation of the [IPLD spec](https://github.com/ipfs/specs/tree/master/ipld).\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Volker Mische](https://github.com/vmx)\n\n## Table of Contents <!-- omit in toc -->\n\n- [Install](#install)\n  - [npm](#npm)\n  - [Use in Node.js](#use-in-nodejs)\n  - [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)\n  - [Use in a browser Using a script tag](#use-in-a-browser-using-a-script-tag)\n- [Usage](#usage)\n- [API](#api)\n  - [`dagCBOR.util.serialize(obj)`](#dagcborutilserializeobj)\n  - [`dagCBOR.util.deserialize(serialized)`](#dagcborutildeserializeserialized)\n  - [`dagCBOR.util.configureDecoder([options])`](#dagcborutilconfiguredecoderoptions)\n  - [`dagCBOR.util.cid(obj[, options,])`](#dagcborutilcidobj-options)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n### npm\n\n```sh\n> npm install ipld-dag-cbor\n```\n\n### Use in Node.js\n\n```JavaScript\nconst dagCBOR = require('ipld-dag-cbor')\n```\n\n### Use in a browser with browserify, webpack or any other bundler\n\nThe code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.\n\n```JavaScript\nvar dagCBOR = require('ipld-dag-cbor')\n```\n\n### Use in a browser Using a script tag\n\nLoading this module through a script tag will make the `IpldDagCbor` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/ipld-dag-cbor/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/ipld-dag-cbor/dist/index.js\"></script>\n```\n\n## Usage\n\n```JavaScript\nconst dagCBOR = require('ipld-dag-cbor')\n\nconst file = {\n  name: 'hello.txt',\n  size: 11\n}\n\nconst serialized = dagCBOR.util.serialize(file)\nconsole.log(`Encoded as a ${serialized.length} byte Uint8Array`)\n\nconst node = dagCBOR.util.deserialize(serialized)\nconsole.log('Decoded as:', node)\nrequire('assert').deepEqual(node, file) // should match\n\n// → Encoded as a 22 byte Uint8Array\n// → Decoded as: { name: 'hello.txt', size: 11 }\n```\n\n## API\n\n### `dagCBOR.util.serialize(obj)`\n\nEncodes an object into IPLD CBOR form, replacing any CIDs found within the object to CBOR tags (with an id of `42`).\n\n - `obj` (any): any object able to be serialized as CBOR\n\nReturns the serialized node.\n\n### `dagCBOR.util.deserialize(serialized)`\n\n Decodes an IPLD CBOR encoded representation, restoring any CBOR tags (id `42`) to CIDs.\n\n  - `serialized` (`Uint8Array` or `String`): a binary blob representing an IPLD CBOR encoded object.\n\nReturns the deserialized object.\n\n### `dagCBOR.util.configureDecoder([options])`\n\nConfigure the underlying CBOR decoder.\n\nPossible values in the `options` argument are:\n\n - `size` (`Number`, optional): the current heap size used in CBOR parsing, this may grow automatically as larger blocks are encountered up to `maxSize`. Default: `65536` (64Kb).\n - `maxSize` (`Number`, optional): the maximum size the CBOR parsing heap is allowed to grow to before `dagCBOR.util.deserialize()` returns an error. Default: `67108864` (64Mb).\n - `tags` (`Object`, optional): an object whose keys are CBOR tag numbers and values are transform functions that accept a `value` and return a decoded representation of that `value`.\n\n The CBOR decoder uses a heap size that is a power of two. Setting `size` to a number other than a power of two will result in a heap using the next-largest power of two.\n\n Calling `dagCBOR.util.configureDecoder()` with no arguments will reset to the default decoder `size`, `maxSize` and `tags`.\n\n### `dagCBOR.util.cid(obj[, options,])`\n\nCreate a [CID](https://github.com/multiformats/js-cid) for the given unserialized object.\n\n - `obj` (any): any object able to be serialized as CBOR\n - `options` (`Object`):\n  * `hashAlg` (`String`): a [registered multicodec](https://github.com/multiformats/multicodec/blob/master/table.csv) hash algorithm.\n  * `hashLen` (`String`): an optional hash length\n  * `version` (`Number`): CID version number, defaults to `1`\n\nReturns a Promise with the created CID.\n\n## Contribute\n\nFeel free to join in. All welcome. Open an [issue](https://github.com/ipld/js-ipld-dag-cbor/issues)!\n\nCheck out our [contributing document](https://github.com/ipld/ipld/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to IPLD are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nSmall note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\n[MIT](LICENSE) © 2015 David Dias\n","publish_time":1485709013329,"_cnpm_publish_time":1485709013329,"dist-tags":{"latest":"1.0.1"}}