{"name":"ipfs-merkle-dag","version":"0.7.1","description":"A JavaScript implementations of the IPFS MerkleDAG implementations (protobufs)","main":"lib/index.js","jsnext:main":"src/index.js","scripts":{"lint":"aegir-lint","build":"aegir-build","test":"aegir-test","test:node":"aegir-test node","test:browser":"aegir-test browser","release":"aegir-release","release-minor":"aegir-release --type minor","release-major":"aegir-release --type major","coverage":"aegir-coverage"},"pre-commit":["lint","test"],"author":{"name":"Vijayee Kulkaa","email":"vijayee.kulkaa@hushmail.com"},"contributors":[{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"James Halliday","email":"mail@substack.net"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vijayee Kulkaa","email":"vijayee.kulkaa@hushmail.com"},{"name":"nginnever","email":"ginneversource@gmail.com"}],"license":"ISC","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs-merkle-dag.git"},"dependencies":{"ipfs-block":"^0.3.0","is-ipfs":"^0.2.0","multihashes":"^0.2.2","multihashing":"^0.2.1","protocol-buffers":"^3.1.6","pull-stream":"^3.4.5","pull-traverse":"^1.0.3","stable":"^0.1.5"},"devDependencies":{"aegir":"^8.0.0","bs58":"^3.0.0","buffer-loader":"0.0.1","chai":"^3.5.0","fs-pull-blob-store":"^0.3.0","idb-pull-blob-store":"^0.4.0","ipfs-block-service":"^0.5.0","ipfs-repo":"^0.9.0","lodash":"^4.15.0","ncp":"^2.0.0","pre-commit":"^1.1.3","rimraf":"^2.5.4","run-series":"^1.1.4"},"gitHead":"e4036932a6a9e65e2094e2505436d7d3355e769d","bugs":{"url":"https://github.com/ipfs/js-ipfs-merkle-dag/issues"},"homepage":"https://github.com/ipfs/js-ipfs-merkle-dag#readme","_id":"ipfs-merkle-dag@0.7.1","_shasum":"a9742ce9fb0da259306afdb1b73ce8ab14ef2c23","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"dignifiedquire","email":"dignifiedquire@gmail.com"},"dist":{"shasum":"a9742ce9fb0da259306afdb1b73ce8ab14ef2c23","tarball":"http://registry-npm.ywwl.com/ipfs-merkle-dag/download/ipfs-merkle-dag-0.7.1.tgz","integrity":"sha512-RyWnkWEOjRNHfFM/E3T752maBJHO8VGZ3uf1gShTC4YXsUfNfU1E8bUVP3sw5NNweF5M8cSt6CLMmpD5qlW0TA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFJPCVovyvxW3KI18RX6XpGjnTpaAd8l+JSWwvF2EK03AiAZyssf9MJl5WfPB4DWB7+hhGhKnHniRkqqeZbMnsUnSQ=="}],"size":673982,"noattachment":false,"key":"/ipfs-merkle-dag/-/ipfs-merkle-dag-0.7.1.tgz"},"maintainers":[{"name":"daviddias","email":"daviddias.p@gmail.com"},{"name":"dignifiedquire","email":"dignifiedquire@gmail.com"},{"name":"vijayee","email":"vijayee.kulkaa@hushmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ipfs-merkle-dag-0.7.1.tgz_1473441988647_0.7238384163938463"},"directories":{},"readme":"# js-ipfs-merkle-dag\n\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/ipfs/js-ipfs-merkle-dag/badge.svg?branch=master)](https://coveralls.io/github/ipfs/js-ipfs-merkle-dag?branch=master)\n[![Travis CI](https://travis-ci.org/ipfs/js-ipfs-merkle-dag.svg?branch=master)](https://travis-ci.org/ipfs/js-ipfs-merkle-dag)\n[![Circle CI](https://circleci.com/gh/ipfs/js-ipfs-merkle-dag.svg?style=svg)](https://circleci.com/gh/ipfs/js-ipfs-merkle-dag)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs-merkle-dag.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-merkle-dag) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\n> JavaScript Implementation of the DAGService and DAGNode data structure\n\n## Table of Contents\n\n- [Install](#install)\n- [Architecture](#architecture)\n- [Usage](#usage)\n- [API](#api)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm i ipfs-merkle-dag\n```\n\n## Architecture\n\n```markdown\n┌────────────────────┐\n│   DAGService       │\n└────────────────────┘\n           │\n           ▼\n┌────────────────────┐\n│   BlockService     │\n└────────────────────┘\n```\n\n**DAGService** - The DAGService offers an interface to interact directly with a MerkleDAG object (composed by one or more DAGNodes that are linked), using the BlockService to store and fetch the DAGNodes as it needs them\n\n[**BlockService** - The BlockService uses IPFS Repo as the local datastore for blocks and an IPFS Exchange compliant implementation to fetch blocks from the network.](https://github.com/ipfs/js-ipfs-block-service)\n\nA DAGNode and DAGLink are data structures made available on this module.\n\n## Usage\n\n```js\nconst ipfsMDAG = require('ipfs-merkle-dag')\n\n// then, to access each of the components\nipfsMDAG.DAGService\nipfsMDAG.DAGNode\nipfsMDAG.DAGLink\n```\n\n## API\n\n### DAGNode Class\n\nCreate a new DAGNode\n\n```JavaScript\nvar node = new ipfsMDAG.DAGNode([<data>, <[links]>])\n```\n\n#### `addNodeLink`\n\n> creates a link on node A to node B by using node B to get its multihash\n\n#### `addRawLink`\n\n> creates a link on node A to node B by using directly node B multihash\n\n#### `updateNodeLink`\n\n> updates a link on the node. *caution* this method returns a copy of the MerkleDAG node\n\n#### `removeNodeLink`\n\n> removes a link from the node by name\n\n#### `removeNodeLinkByHash`\n\n> removes a link from the node by the hash of the linked node\n\n\n#### `copy`\n\n> creates a copy of the MerkleDAG Node\n\n#### `size`\n\n> (property) size of the node, in bytes\n\n#### `links`\n\n> (property) an array of `DAGLink`s belonging to the node\n\n#### `multihash`\n\n> returns the multihash (default: sha2-256)\n\n#### `marshal`\n\n> returns a protobuf serialized version, compatible with go-ipfs MerkleDAG\n\n#### `unMarshal`\n\n> deserializes a node encoded using protobuf\n\n#### `getPBNode`\n\n> used internally\n\n#### `makeLink`\n\n> used internally\n\n### DAGLink Class\n\nCreate a new DAGLink\n\n```JavaScript\nvar link = new ipfsMDAG.DAGLink(<name>, <size>, <hash>)\n```\n\n### DAGService\n\n#### `put`\n\n> stores the node\n\n#### `putStream`\n\n> stores nodes using a writable pull-stream\n\n#### `get`\n\n> fetches a node by its multihash\n\n#### `getStream`\n\n> fetches a node as a pull-stream\n\n#### `getRecursive`\n\n> fetches a node and all of its links (if possible)\n\n#### `getRecursiveStream`\n\n> fetches a node and all of its links (if possible) as pull-stream\n\n#### `remove`\n\n> deletes a node\n\n## License\n\nMIT © IPFS\n","publish_time":1473441990472,"_cnpm_publish_time":1473441990472,"dist-tags":{"latest":"0.7.3"}}