ipfs-api
Version:
A client library for the IPFS HTTP API
38 lines (32 loc) • 744 B
JavaScript
const promisify = require('promisify-es6')
const cleanMultihash = require('../utils/clean-multihash')
module.exports = (send) => {
const objectGet = require('./get')(send)
return promisify((multihash, dLink, opts, callback) => {
if (typeof opts === 'function') {
callback = opts
opts = {}
}
if (!opts) {
opts = {}
}
try {
multihash = cleanMultihash(multihash, opts)
} catch (err) {
return callback(err)
}
send({
path: 'object/patch/rm-link',
args: [
multihash,
dLink.name
]
}, (err, result) => {
if (err) {
return callback(err)
}
objectGet(result.Hash, { enc: 'base58' }, callback)
})
})
}