node-ipld

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

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) {})
npm i node-ipld

Metadata

  • MIT
  • Whatever
  • David Dias
  • released 9/1/2015

Downloads

Maintainers