Show diagnostic information on the bitswap agent.
Note: stats.bitswap
and bitswap.stat
can be used interchangeably. See bitswap.stat
for more details.
Get stats for the currently used repo.
Note: stats.repo
and repo.stat
can be used interchangeably. See repo.stat
for more details.
Get IPFS bandwidth information.
Where:
options
is an optional object that might contain the following keys:peer
specifies a peer to print bandwidth for.proto
specifies a protocol to print bandwidth for.poll
is used to yield bandwidth info at an interval.interval
is the time interval to wait between updating output, ifpoll
istrue
.
Returns
Type | Description |
---|---|
AsyncIterable<Object> |
An async iterable that yields IPFS bandwidth information |
Each yielded object contains the following keys:
totalIn
- is a BigNumber Int, in bytes.totalOut
- is a BigNumber Int, in bytes.rateIn
- is a BigNumber Int, in bytes.rateOut
- is a BigNumber Int, in bytes.
Example:
for await (const stats of ipfs.stats.bw()) {
console.log(stats)
}
// { totalIn: BigNumber {...},
// totalOut: BigNumber {...},
// rateIn: BigNumber {...},
// rateOut: BigNumber {...} }
A great source of examples can be found in the tests for this API.