Adds an IPFS object to the pinset and also stores it to the IPFS repo. pinset is the set of hashes currently pinned (not gc'able).
stats.bitswap
and bitswap.stat
can be used interchangeably.
callback
must follow function (err, stats) {}
signature, where err
is an error if the operation was not successful. stats
is an Object containing the following keys:
provideBufLen
is an integer.wantlist
(array)peers
(array)blocksReceived
is a Big IntdataReceived
is a Big IntblocksSent
is a Big IntdataSent
is a Big IntdupBlksReceived
is a Big IntdupDataReceived
is a Big Int
If no callback
is passed, a promise is returned.
Example:
ipfs.stats.bitswap((err, stats) => console.log(stats))
// { provideBufLen: 0,
// wantlist: null,
// peers:
// [ 'QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
// 'QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
// 'QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd' ],
// blocksReceived: 0,
// dataReceived: 0,
// blocksSent: 0,
// dataSent: 0,
// dupBlksReceived: 0,
// dupDataReceived: 0 }