ipfs-api
Version:
A client library for the IPFS HTTP API
28 lines (23 loc) • 518 B
JavaScript
const promisify = require('promisify-es6')
const cleanMultihash = require('../utils/clean-multihash')
module.exports = (send) => {
return promisify((multihash, 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/stat',
args: multihash
}, callback)
})
}