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.
None
An optional object which may have the following keys:
Name | Type | Default | Description |
---|---|---|---|
peer | PeerId, CID or String |
undefined |
Specifies a peer to print bandwidth for |
proto | String |
undefined |
Specifies a protocol to print bandwidth for |
poll | boolean |
undefined |
Is used to yield bandwidth info at an interval |
interval | Number |
undefined |
The time interval to wait between updating output, if poll is true |
timeout | Number |
undefined |
A timeout in ms |
signal | AbortSignal | undefined |
Can be used to cancel any long running requests started as a result of this call |
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.
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.