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

Commit

Permalink
fix: improve bitswap wantlist and unwant docs
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
alanshaw committed Jun 18, 2018
1 parent 9f81bcb commit 7737546
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions SPEC/BITSWAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,52 @@
##### `Go` **WIP**

##### `JavaScript` - ipfs.bitswap.unwant(cid)
##### `JavaScript` - ipfs.bitswap.unwant(cid, [callback])

`cid` is a [cid][cid] which can be passed as:

- CID, a CID instance
- String, the base58 encoded version of the multihash

`callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful.

**Example:**

```JavaScript
ipfs.bitswap.unwant('QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu', (err) => {
if (err) throw err
console.log('Done')
})
```

##### `Go` **WIP**

### `bitswap.wantlist`

> Returns the wantlist, optionally limited by peerID
> Returns the wantlist, optionally filtered by peer ID
#### `Go` **WIP**

#### `JavaScript` - ipfs.bitswap.wantlist([peerId])
#### `JavaScript` - ipfs.bitswap.wantlist([peerId], [callback])

`callback` must follow `function (err, list) {}` signature, where `err` is an error if the operation was not successful. `list` is an Object containing the following keys:

- `Keys` An array of objects containing the following keys:
- `/` A string multihash

If no `callback` is passed, a promise is returned.

**Example:**

```JavaScript
ipfs.bitswap.wantlist((err, list) => console.log(list))

//[ { Wantlist object }, ... ]
// { Keys: [{ '/': 'QmHash' }] }

ipfs.bitswap.wantlist(peerId, (err, list) => console.log(list))

//[ { Wantlist object }, ... ]
// { Keys: [{ '/': 'QmHash' }] }
```

#### `bitswap.stat`

Expand Down

0 comments on commit 7737546

Please sign in to comment.