{"name":"ipfs-merkle-dag","version":"0.0.2","description":"A JavaScript implementations of the IPFS MerkleDAG implementations (protobufs)","main":"./src/index.js","scripts":{"test":"node tests/index.js","lint":"standard"},"pre-commit":["lint","test"],"author":{"name":"Vijayee Kulkaa","email":"vijayee.kulkaa@hushmail.com"},"contributors":[{"name":"David Dias","email":"daviddias@ipfs.io"}],"license":"ISC","dependencies":{"bl":"^1.0.0","buffer":"^4.2.0","datastore.abstract":"0.0.1","datastore.memory":"0.0.0","extend":"^3.0.0","fs-blob-store":"^5.2.1","ipfs-repo":"^0.3.0","multihashing":"^0.2.0","protocol-buffers":"^3.1.4"},"devDependencies":{"async":"^1.5.2","ncp":"^2.0.0","pre-commit":"^1.1.2","rimraf":"^2.5.0","standard":"^5.4.1","tape":"^4.4.0"},"gitHead":"194653bb477cd56a995fdd6ef38a9dd99f283db0","_id":"ipfs-merkle-dag@0.0.2","_shasum":"df1b089e17a37a5ffbb213ec863422e7a6abfe25","_from":".","_npmVersion":"3.3.8","_nodeVersion":"4.2.1","_npmUser":{"name":"vijayee","email":"vijayee.kulkaa@hushmail.com"},"dist":{"shasum":"df1b089e17a37a5ffbb213ec863422e7a6abfe25","tarball":"http://registry-npm.ywwl.com/ipfs-merkle-dag/download/ipfs-merkle-dag-0.0.2.tgz","integrity":"sha512-G08a1tHrl+V3dEtkqd8X1N8j57uYN6bg+bs8/cEVWnEcrrmLgZCjE8YAh4aLJkkh9RZtIP4MMxJkN+trwk+/Lw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEkHf9hap/kQDeOsqYTeT+S8VjyXhQfhUBnhTKo9LvUAAiEAl55RT47MOCHrwrGpK+DzYZ9YvV5E4QlJPpbenc5Fv7g="}],"size":20699,"noattachment":false,"key":"/ipfs-merkle-dag/-/ipfs-merkle-dag-0.0.2.tgz"},"maintainers":[{"name":"vijayee","email":"vijayee.kulkaa@hushmail.com"}],"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":1453229289693,"_cnpm_publish_time":1453229289693,"dist-tags":{"latest":"0.7.3"}}