Assuming I\'m adding data to IPFS like this:
$ echo Hello World | ipfs add
This will give me QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJ
I'm not sure what that encoding is but you can unmarshal the dag data field like this in js-ipfs:
const IPFS = require('ipfs')
const Unixfs = require('ipfs-unixfs')
const ipfs = new IPFS
ipfs.dag.get('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u', (err, d) => {
console.log(Unixfs.unmarshal(d.value.data).data.toString()))
// prints Hello World
})