UNPKG

ipfs

Version:

JavaScript implementation of the IPFS specification

21 lines (15 loc) 508 B
'use strict' const print = require('../../utils').print module.exports = { command: 'stat <key>', describe: 'Get stats for the DAG node named by <key>', builder: {}, handler ({ getIpfs, key, cidBase, resolve }) { resolve((async () => { const ipfs = await getIpfs() const stats = await ipfs.object.stat(key, { enc: 'base58' }) delete stats.Hash // only for js-ipfs-http-client output Object.keys(stats).forEach((key) => print(`${key}: ${stats[key]}`)) })()) } }