JSPM

  • Created
  • Published
  • Downloads 8065
  • Score
    100M100P100Q48370F
  • License MIT

Node.js implementation of the IPLD (InterpPlanetary Linked Data)

Package Exports

  • ipld

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ipld) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-ipld

Node.js implementation of the IPLD spec.

Description

Usage

IPLD contexts and types

console.log(ipld.context)
# { merkleweb: { mlink: 'http://merkle-link' } }
console.log(ipld.type)
# { mlink: 'http://merkle-link' }

expand an obj

var node = {
  data: 'aaah the data',
  mlink: 'QmdasdSHJKDADHAgimethehasssssh' // should be a valid IPFS hash
}

node['@context'] = ipld.context.merkleweb
console.log(ipld.expand(node))
# { data: 'aaah the data', 'http://merkle-link': 'QmdasdSHJKDADHAgimethehasssssh'}

marshal and unmarshal

ipld.marshal(obj) // returns Buffer with CBOR encoded obj
ipld.unmarshal(buf, function (err, result) {})