Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Latest commit

 

History

History
61 lines (41 loc) · 1.73 KB

STATS.md

File metadata and controls

61 lines (41 loc) · 1.73 KB

Stats API

stats.bitswap

Show diagnostic information on the bitswap agent.

Note: stats.bitswap and bitswap.stat can be used interchangeably. See bitswap.stat for more details.

stats.repo

Get stats for the currently used repo.

Note: stats.repo and repo.stat can be used interchangeably. See repo.stat for more details.

stats.bw

Get IPFS bandwidth information.

ipfs.stats.bw([options])

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, if poll is true.

Returns

Type Description
AsyncIterable<Object> An async iterable that yields IPFS bandwidth information

Each yielded object contains the following keys:

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.