node-ipld

0.1.0 • Public • Published

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) {})

Readme

Keywords

Package Sidebar

Install

npm i node-ipld

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • daviddias
  • vmx