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

Latest commit

 

History

History
51 lines (37 loc) · 1.35 KB

BITSWAP.md

File metadata and controls

51 lines (37 loc) · 1.35 KB

Bitswap API

wantlist (not spec'ed yet)

unwant (not spec'ed yet)

stat

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).

Go WIP
JavaScript - ipfs.bitswap.stat([callback])

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 Int
  • dataReceived is a Big Int
  • blocksSent is a Big Int
  • dataSent is a Big Int
  • dupBlksReceived is a Big Int
  • dupDataReceived 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 }