{"name":"ipfs-merkle-dag","version":"0.3.0","description":"A JavaScript implementations of the IPFS MerkleDAG implementations (protobufs)","main":"./src/index.js","scripts":{"test":"npm run test:node && npm run test:browser","test:node":"mocha tests/index.js","test:browser":"karma start --single-run=true karma.conf.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","repository":{"type":"git","url":"git+https://github.com/vijayee/js-ipfs-merkle-dag.git"},"dependencies":{"bl":"^1.0.0","ipfs-blocks":"^0.1.0","multihashing":"^0.2.0","protocol-buffers":"^3.1.4","stable":"^0.1.5"},"devDependencies":{"async":"^1.5.2","brfs":"^1.4.3","bs58":"^3.0.0","buffer-loader":"0.0.1","chai":"^3.5.0","fs-blob-store":"^5.2.1","idb-plus-blob-store":"^1.0.0","ipfs-repo":"^0.5.3","json-loader":"^0.5.4","karma":"^0.13.19","karma-chrome-launcher":"^0.2.2","karma-cli":"^0.1.2","karma-firefox-launcher":"^0.1.7","karma-mocha":"^0.2.1","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.24","karma-webpack":"^1.7.0","lodash":"^4.6.1","mocha":"^2.4.5","ncp":"^2.0.0","pre-commit":"^1.1.2","rimraf":"^2.5.0","standard":"^6.0.8","transform-loader":"^0.2.3","webpack":"^2.0.7-beta"},"gitHead":"f7cfd7f05d3db6e4979f0dc8a117b3219574144d","bugs":{"url":"https://github.com/vijayee/js-ipfs-merkle-dag/issues"},"homepage":"https://github.com/vijayee/js-ipfs-merkle-dag#readme","_id":"ipfs-merkle-dag@0.3.0","_shasum":"7c6b6f77c90521572db1c62257aa2c61fd090908","_from":".","_npmVersion":"3.8.0","_nodeVersion":"4.3.2","_npmUser":{"name":"daviddias","email":"daviddias.p@gmail.com"},"maintainers":[{"name":"daviddias","email":"daviddias.p@gmail.com"},{"name":"vijayee","email":"vijayee.kulkaa@hushmail.com"}],"dist":{"shasum":"7c6b6f77c90521572db1c62257aa2c61fd090908","tarball":"http://registry-npm.ywwl.com/ipfs-merkle-dag/download/ipfs-merkle-dag-0.3.0.tgz","integrity":"sha512-qZ92Xl8LFcDdfUSHoQd0ocFtJLEvGgt4IaK2r2A9tWFiPDgms6lqGXF9KPj3wkSZh6vDfDvtdH9OwsPolpGRBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICpYWA4GFDBt8wUt8zSrNbZ/cF7U8r7YSB2u6f0mAE3IAiEAtxXvtahLCz228cabZPU5db3P2iolMQxY0nIhjfSplvg="}],"size":24014,"noattachment":false,"key":"/ipfs-merkle-dag/-/ipfs-merkle-dag-0.3.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ipfs-merkle-dag-0.3.0.tgz_1458584734160_0.8498002889100462"},"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":1458584736651,"_cnpm_publish_time":1458584736651,"dist-tags":{"latest":"0.7.3"}}