Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs/js-ipfs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: [email protected]
Choose a base ref
...
head repository: ipfs/js-ipfs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: [email protected]
Choose a head ref

Commits on Jun 24, 2020

  1. Copy the full SHA
    3808ac0 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    881bc08 View commit details

Commits on Jun 25, 2020

  1. chore(deps): bump multihashing-async from 0.8.2 to 1.0.0 (#3122)

    Bumps [multihashing-async](https://github.com/multiformats/js-multihashing-async) from 0.8.2 to 1.0.0.
    - [Release notes](https://github.com/multiformats/js-multihashing-async/releases)
    - [Changelog](https://github.com/multiformats/js-multihashing-async/blob/master/CHANGELOG.md)
    - [Commits](multiformats/js-multihashing-async@v0.8.2...v1.0.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    
    Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
    dependabot-preview[bot] authored Jun 25, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    343bd45 View commit details

Commits on Jul 1, 2020

  1. fix: still load dag-pb, dag-cbor and raw when specifying custom forma…

    …ts (#3132)
    
    If we specify a `formats` array as part of the ipld options in in-proc
    nodes, it replaces the default list of dag-pb, dag-cbor and raw.
    
    This change allows the `loadFormat` function to still resolve those
    formats even if the user has passed a `format` array that does not
    contain them.
    
    Fixes #3129
    achingbrain authored Jul 1, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a96e3bc View commit details
  2. chore: update example with public webrtc servers (#3126)

    Per #2779 , this PR adds the public webrtc servers to the browser example.
    
    This allows users to run easily the example, but also provides information for how users should use a signaling server for production.
    vasco-santos authored Jul 1, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0b64c3e View commit details

Commits on Jul 2, 2020

  1. feat: store blocks by multihash instead of CID (#3124)

    Updates the `ipfs-repo` dep to a version that stores blocks by multihash instead of CID to support CIDv1 and CIDv0 access to the same block.
    
    New features:
    
    - Adds a `--multihash` argument to the cli command `ipfs refs local` which prints the base32 encoded multihash of each block
    
    BREAKING CHANGES:
    
    - `ipfs.refs.local` now returns a v1 CID with the raw codec for every block and not the original CID by which it was added to the blockstore
    
    Co-authored-by: Hugo Dias <hugomrdias@gmail.com>
    achingbrain and hugomrdias authored Jul 2, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    03b17f5 View commit details
  2. feat: add interface and http client versions to version output (#3125)

    Adds `interface-ipfs-core` and `ipfs-http-client` versions to the output of the `ipfs version` command, also the git commit id if it's available.
    
    Closes #2878
    achingbrain authored Jul 2, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    65f8b23 View commit details
  3. fix: optional arguments go in the options object (#3118)

    We have a few older APIs that take multiple optional arguments, which makes our code more complicated as it has to guess the users' intent, sometimes by inspecting properties on the passed args to see if they happen to correspond with properties on the actual options object.
    
    The options object was recently added to all API calls and is the right place for optional arguments to go, so the change here is to move all optional arguments into the options object, except where the presence of an optional argument dramatically changes the behaviour of the call (`ipfs.bootstrap` I'm mostly looking at you), in which case the methods are split out into multiple versions that do distinct things.
    
    Only the programatic API is affected, the CLI and HTTP APIs do not change.
    
    BREAKING CHANGES:
    
    - `ipfs.bitswap.wantlist([peer], [options])` is split into:
      - `ipfs.bitswap.wantlist([options])`
      - `ipfs.bitswap.wantlistForPeer(peer, [options])`
    - `ipfs.bootstrap.add([addr], [options])` is split into:
      - `ipfs.bootstrap.add(addr, [options])` - add a bootstrap node
      - `ipfs.bootstrap.reset()` - restore the default list of bootstrap nodes
    - `ipfs.bootstrap.rm([addr], [options])` is split into:
      - `ipfs.bootstrap.rm(addr, [options])` - remove a bootstrap node
      - `ipfs.bootstrap.clear([options])` - empty the bootstrap list
    - `ipfs.dag.get(cid, [path], [options])` becomes `ipfs.dag.get(cid, [options])`
      - `path` is moved into the `options` object
    - `ipfs.dag.tree(cid, [path], [options])` becomes `ipfs.dag.tree(cid, [options])`
      - `path` is moved into the `options` object
    - `ipfs.dag.resolve(cid, [path], [options])` becomes `ipfs.dag.resolve(cid, [options])`
      - `path` is moved into the `options` object
    - `ipfs.files.flush([path], [options])` becomes `ipfs.files.flush(path, [options])`
    - `ipfs.files.ls([path], [options])` becomes `ipfs.files.ls(path, [options])`
    - `ipfs.object.new([template], [options])` becomes `ipfs.object.new([options])`
      - `template` is moved into the `options` object
    - `ipfs.pin.ls([paths], [options])` becomes `ipfs.pin.ls([options])`
      - `paths` is moved into the `options` object
    
    Co-authored-by: Hugo Dias <hugomrdias@gmail.com>
    achingbrain and hugomrdias authored Jul 2, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8cb8c73 View commit details

Commits on Jul 3, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    62c1422 View commit details

Commits on Jul 7, 2020

  1. feat: add size-only flag to cli repo stat command (#3143)

    Makes `stats repo` an alias for `repo stat` to make formatting the same across commmands in line with go-ipfs.
    
    Also adds `-s` flag to both commands to print just the size info.
    achingbrain authored Jul 7, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b4d3bf8 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    77ecfef View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ab3127f View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4309e10 View commit details
  5. fix: unhandledpromiserejection in electron tests (#3146)

    When this method is async (without any actual async work) the
    'should fail to publish if does not receive private key' test
    experiences an UnhandledPromiseRejection in electron, though the
    test still passes.
    achingbrain authored Jul 7, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4c0c67f View commit details
  6. chore(deps-dev): bump nock from 12.0.3 to 13.0.2 (#3136)

    Bumps [nock](https://github.com/nock/nock) from 12.0.3 to 13.0.2.
    - [Release notes](https://github.com/nock/nock/releases)
    - [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
    - [Commits](nock/nock@v12.0.3...v13.0.2)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    
    Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
    dependabot-preview[bot] authored Jul 7, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5fe9495 View commit details

Commits on Jul 8, 2020

  1. fix: use post for preloading (#3149)

    As we don't accept get requests via the http api any more
    achingbrain authored Jul 8, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c9700f7 View commit details
  2. fix: set error code correctly (#3150)

    Fixes a typo
    achingbrain authored Jul 8, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    335c13d View commit details

Commits on Jul 9, 2020

  1. fix: do not list raw nodes in a dag as directories (#3155)

    `ipfs ls QMfoo` was listing raw nodes as directories when present in a
    DAG.
    
    Also does not try to parse chmod strings as octals to allow `+x` etc
    on the command line the same as the programattic API
    achingbrain authored Jul 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    585a142 View commit details
  2. refactor: return promise from dag resolve (#3152)

    Makes `ipfs.dag.resolve` behave the same when calling into core and over the http api.
    
    Adds documentation and interface tests for `ipfs.dag.resolve`.
    
    Supersedes #3131
    Fixes #2962
    
    BREAKING CHANGES:
    
    - `ipfs.dag.resolve` returns `Promise<{ cid, remainderPath }` instead of `AsyncIterator<{ value, remainderPath }>`
      - Previously the core api returned an async iterator and the http client returned a simple promise
    
    Co-authored-by: Tarun Batra <tarun.batra00@gmail.com>
    achingbrain and tarunbatra authored Jul 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f20cdf1 View commit details
  3. fix: peer ids are strings now (#3162)

    Cleans up last bits of libp2p's peerID -> string migration
    achingbrain authored Jul 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    281bfe6 View commit details

Commits on Jul 10, 2020

  1. feat: enable DHT by Routing.Type config key (#3153)

    Updates use of the kad-dht module in the codebase.
    
    New features:
    
    1. Adds [Routing.Type](https://github.com/ipfs/go-ipfs/blob/b86e93045aaa0ac357d939884e1c7996b0fcdbd4/docs/config.md#routing) configuration key with values
      - `'none'` default, DHT disabled
      - `'dht'` DHT start-as-client-auto-upgrade-to-server (not implemented in `js-libp2p-kad-dht` yet)
      - `'dhtserver'` DHT server mode
      - `'dhtclient'` DHT client mode
    2. Updates Core API to be compliant with the docs
    
    Co-authored-by: Jacob Heun <jacobheun@gmail.com>
    achingbrain and jacobheun authored Jul 10, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    dfe15d7 View commit details
  2. feat: turn on delegate nodes by default (#3148)

    To help find content and peers on the network, turn on delegate nodes by default.
    
    Disables delegate nodes while using the `test` config profile.
    achingbrain authored Jul 10, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3fd2ca8 View commit details

Commits on Jul 11, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c6cd95c View commit details

Commits on Jul 15, 2020

  1. docs: fix weird whitespace character (#3170)

    VSCode seems to insert this weird whitespace character that isn't a
    space but looks like a space and then messes up all the formatting
    in markdown files.
    achingbrain authored Jul 15, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f3f8d2a View commit details
  2. docs: update http client examples (#3172)

    Moves http client examples to the examples folder and adds tests to prevent regressions.
    achingbrain authored Jul 15, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5b5eabc View commit details

Commits on Jul 16, 2020

  1. chore: swap go-ipfs-dep for go-ipfs (#3174)

    It has a much better name.
    achingbrain authored Jul 16, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8c122e8 View commit details
  2. refactor: make add only work on single items (#3167)

    `ipfs.add` now returns single items only.  Where a source would result in multiple items returned, only the last item is returned.  As a first pass `ipfs.add` still takes multiple items but only accepting single items is documented and considered supported.  In the future it may throw if multiple items are passed.
    
    `ipfs.addAll` retains the previous behaviour of `ipfs.add`.
    
    Examples:
    
    ```javascript
    const { cid, path, mode, mtime } = await ipfs.add('Hello world')
    ```
    
    ```javascript
    const { cid } = await ipfs.add(Uint8Array.from([0, 1, 2]))
    ```
    
    ```javascript
    const { cid } = await ipfs.add(fs.createReadStream('/path/to/file.txt'))
    ```
    
    ```javascript
    const { cid } = await ipfs.add({
      path: '/foo/bar/baz.txt',
      content: 'File content'
    })
    
    // Creates a DAG with multiple levels of directories.
    // The returned cid is the CID for the root directory /foo
    
    // You can retrieve the file content with an IPFS path
    for await (const buf of ipfs.cat(`/ipfs/${cid}/bar/baz.txt`)) {
      ...
    }
    
    // Or get the CID of the nested file with ipfs.files.stat
    const { cid: fileCid } = await ipfs.files.stat(`/ipfs/${cid}/bar/baz.txt`)
    
    // or ipfs.dag.resolve
    const { cid: fileCid } = await ipfs.dag.resolve(`/ipfs/${cid}/bar/baz.txt`)
    ```
    
    ```javascript
    // To have `/foo` included in the ipfs path, wrap it in a directory:
    const { cid } = await ipfs.add({
      path: '/foo/bar/baz.txt',
      content: 'File content'
    }, {
      wrapWithDirectory: true
    })
    
    for await (const buf of ipfs.cat(`/ipfs/${cid}/foo/bar/baz.txt`)) {
      ...
    }
    ```
    
    BREAKING CHANGES:
    
    - `ipfs.add` only works on single items - a Uint8Array, a String, an AsyncIterable<Uint8Array> etc
    - `ipfs.addAll` works on multiple items
    achingbrain authored Jul 16, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1760b89 View commit details
  3. fix: small whitespace change

    BREAKING CHANGE:
    
    - not really
    achingbrain committed Jul 16, 2020
    Copy the full SHA
    0d4604d View commit details
  4. chore: revert previous

    achingbrain committed Jul 16, 2020
    Copy the full SHA
    40e0e7b View commit details
  5. Copy the full SHA
    b780935 View commit details
  6. chore: publish

     - interface-ipfs-core@0.138.0
     - ipfs-core-utils@0.3.0
     - ipfs-http-client@45.0.0
     - ipfs@0.48.0
    achingbrain committed Jul 16, 2020
    Copy the full SHA
    a64939b View commit details
Showing 370 changed files with 4,049 additions and 2,328 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Checks
# Checks bundlesize, does not run on master
name: Bundlesize

on: [push]
on:
push:
branches:
- '*'
- '!master'

jobs:
checks:
39 changes: 39 additions & 0 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,11 @@
- [Build a dist version](#build-a-dist-version)
- [Publishing new versions](#publishing-new-versions)
- [Using prerelease versions](#using-prerelease-versions)
- [Testing strategy](#testing-strategy)
- [CLI](#cli)
- [HTTP API](#http-api)
- [Core](#core)
- [Non-Core](#non-core)

## Clone and install dependencies

@@ -64,3 +69,37 @@ Please run the linter before submitting a PR, the build will not pass if it fail
## Using prerelease versions

Any changed packages from each successful build of master are published to npm as canary builds under the npm tag `next`.

## Testing strategy

This project has a number of components that have their own tests, then some components that share interface tests.

When adding new features you may need to add tests to one or more of the test suites described below.

### CLI

Tests live in [/packages/ipfs/test/cli](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/test/cli).

All interactions with IPFS core are stubbed so we just ensure that the correct arguments are passed in

### HTTP API

Tests live in [/packages/ipfs/test/http-api](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/test/http-api) and are similar to the CLI tests in that we stub out core interactions and inject requests with [shot](https://www.npmjs.com/package/@hapi/shot).

### Core

Anything non-implementation specific should be considered part of the 'Core API'. For example node setup code is not Core, but anything that does useful work, e.g. network/repo/etc interactions would be Core.

All Core APIs should be documented in [/docs/core-api](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api).

All Core APIs should have comprehensive tests in [/packages/interface-ipfs-core](https://github.com/ipfs/js-ipfs/tree/master/packages/interface-ipfs-core).

`interface-ipfs-core` should ensure API compatibility across implementations. Tests are run:

1. Against [/packages/ipfs/src/core](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/core) directly
1. Against [/packages/ipfs/src/http](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/src/http) over HTTP via `ipfs-http-client`
1. Against `go-ipfs` over HTTP via `ipfs-http-client`

### Non-Core

Any non-core API functionality should have tests in the `tests` directory of the module in question, for example: [/packages/ipfs-http-api/tests](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client/test) and [/packages/ipfs/tests](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs/test) for `ipfs-http-client` and `ipfs` respectively.
4 changes: 2 additions & 2 deletions docs/RELEASE_ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@
- [ ] Publish a release candidate to npm
```sh
# All successful builds of master update the `build/last-successful` branch
# which contains an `npm-shrinkwrap.json`.
# which contains an `npm-shrinkwrap.json`.
# This command checks that branch out, installs it's dependencies using `npm ci`,
# creates a release branch (e.g. release/v0.34.x), updates the minor prerelease
# version (e.g. 0.33.1 -> 0.34.0-rc.0) and publishes it to npm.
@@ -60,7 +60,7 @@
npx aegir update-release-branch-lockfiles release/v0.34.x

# Then update the rc published on npm. This command pulls the specified
# release branch, installs it's dependencies `npm ci`, increments the
# release branch, installs it's dependencies `npm ci`, increments the
# prerelease version (e.g. 0.34.0-rc.0 -> 0.34.0-rc.1) and publishes it
# to npm.
npx aegir update-rc release/v0.34.x
54 changes: 44 additions & 10 deletions docs/core-api/BITSWAP.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
# Bitswap API <!-- omit in toc -->

- [`ipfs.bitswap.wantlist([peerId,] [options])`](#ipfsbitswapwantlistpeerid-options)
- [`ipfs.bitswap.wantlist([options])`](#ipfsbitswapwantlistoptions)
- [Parameters](#parameters)
- [Options](#options)
- [Returns](#returns)
- [Example](#example)
- [`ipfs.bitswap.unwant(cids, [options])`](#ipfsbitswapunwantcids-options)
- [`ipfs.bitswap.wantlistForPeer(peerId, [options])`](#ipfsbitswapwantlistforpeerpeerid-options)
- [Parameters](#parameters-1)
- [Options](#options-1)
- [Returns](#returns-1)
- [Example](#example-1)
- [`ipfs.bitswap.stat([options])`](#ipfsbitswapstatoptions)
- [`ipfs.bitswap.unwant(cids, [options])`](#ipfsbitswapunwantcids-options)
- [Parameters](#parameters-2)
- [Options](#options-2)
- [Returns](#returns-2)
- [Example](#example-2)
- [`ipfs.bitswap.stat([options])`](#ipfsbitswapstatoptions)
- [Parameters](#parameters-3)
- [Options](#options-3)
- [Returns](#returns-3)
- [Example](#example-3)

## `ipfs.bitswap.wantlist([peerId,] [options])`
## `ipfs.bitswap.wantlist([options])`

> Returns the wantlist, optionally filtered by peer ID
> Returns the wantlist for your node
### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| peerId | [PeerId][], [CID][], `String` or `Buffer` | An optional peer ID to return the wantlist for |
None

### Options

@@ -47,9 +50,40 @@ An optional object which may have the following keys:
const list = await ipfs.bitswap.wantlist()
console.log(list)
// [ CID('QmHash') ]
```

A great source of [examples][] can be found in the tests for this API.

## `ipfs.bitswap.wantlistForPeer(peerId, [options])`

> Returns the wantlist for a connected peer
### Parameters

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| peerId | [PeerId][], [CID][], `String` or `Buffer` | A peer ID to return the wantlist for |

### Options

An optional object which may have the following keys:

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| 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 |

### Returns

| Type | Description |
| -------- | -------- |
| `Promise<CID[]>` | An array of [CID][]s currently in the wantlist |

const list2 = await ipfs.bitswap.wantlist(peerId)
console.log(list2)
### Example

```JavaScript
const list = await ipfs.bitswap.wantlistForPeer(peerId)
console.log(list)
// [ CID('QmHash') ]
```

6 changes: 3 additions & 3 deletions docs/core-api/BLOCK.md
Original file line number Diff line number Diff line change
@@ -75,8 +75,8 @@ An optional object which may have the following keys:
| format | `String` | `'dag-pb'` | The codec to use to create the CID |
| mhtype | `String` | `sha2-256` | The hashing algorithm to use to create the CID |
| mhlen | `Number` | | |
| version | `Number` | 0 | The version to use to create the CID |
| pin | `boolean` | false | If true, pin added blocks recursively |
| version | `Number` | `0` | The version to use to create the CID |
| pin | `boolean` | `false` | If true, pin added blocks recursively |
| 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 |

@@ -137,7 +137,7 @@ An optional object which may have the following keys:
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| force | `boolean` | `false` | Ignores nonexistent blocks |
| quiet | `boolean` | `false | Write minimal output |
| quiet | `boolean` | `false` | Write minimal output |
| 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 |

116 changes: 101 additions & 15 deletions docs/core-api/BOOTSTRAP.md
Original file line number Diff line number Diff line change
@@ -4,46 +4,53 @@
Warning: your node requires bootstrappers to join the network and find other peers.

If you edit this list, you may find you have reduced or no connectivity. If this is the case, please reset your node's bootstrapper list with `ipfs.bootstrap.add({ default: true })`.
If you edit this list, you may find you have reduced or no connectivity. If this is the case, please reset your node's bootstrapper list with `ipfs.bootstrap.reset()`.

- [`ipfs.bootstrap.add([addr,] [options])`](#ipfsbootstrapaddaddr-options)
- [`ipfs.bootstrap.add(addr, [options])`](#ipfsbootstrapaddaddr-options)
- [Parameters](#parameters)
- [Options](#options)
- [Returns](#returns)
- [Example](#example)
- [`ipfs.bootstrap.list([options])`](#ipfsbootstraplistoptions)
- [`ipfs.bootstrap.reset([options])`](#ipfsbootstrapresetoptions)
- [Parameters](#parameters-1)
- [Options](#options-1)
- [Returns](#returns-1)
- [Example](#example-1)
- [`ipfs.bootstrap.rm([addr,] [options])`](#ipfsbootstraprmaddr-options)
- [`ipfs.bootstrap.list([options])`](#ipfsbootstraplistoptions)
- [Parameters](#parameters-2)
- [Options](#options-2)
- [Returns](#returns-2)
- [Example](#example-2)

## `ipfs.bootstrap.add([addr,] [options])`
- [`ipfs.bootstrap.rm(addr, [options])`](#ipfsbootstraprmaddr-options)
- [Parameters](#parameters-3)
- [Options](#options-3)
- [Returns](#returns-3)
- [Example](#example-3)
- [`ipfs.bootstrap.clear([options])`](#ipfsbootstrapclearoptions)
- [Parameters](#parameters-4)
- [Options](#options-4)
- [Returns](#returns-4)
- [Example](#example-4)

## `ipfs.bootstrap.add(addr, [options])`

> Add a peer address to the bootstrap list
### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| addr | [MultiAddr][] | The address of a network peer. If omitted the `default` option must be passed as `true`. |
| addr | [MultiAddr][] | The address of a network peer |

### Options

An optional object which may have the following keys:

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| default | `boolean` | `false` | If true, add the default peers to the list |
| 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 |

Note: If passing the `default` option, `addr` is an optional parameter (may be `undefined`/`null`) and options may be passed as the first argument. i.e. `ipfs.bootstrap.add({ default: true })`

### Returns

| Type | Description |
@@ -71,6 +78,48 @@ console.log(res.Peers)

A great source of [examples][] can be found in the tests for this API.

## `ipfs.bootstrap.reset([options])`

> Reset the bootstrap list to contain only the default bootstrap nodes
### Parameters

None.

### Options

An optional object which may have the following keys:

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| 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 |

### Returns

| Type | Description |
| -------- | -------- |
| `Promise<{ Peers: Array<MultiAddr> }>` | An object that contains an array with all the added addresses |

example of the returned object:

```JavaScript
{
Peers: [address1, address2, ...]
}
```

### Example

```JavaScript
const res = await ipfs.bootstrap.reset()
console.log(res.Peers)
// Logs:
// ['/ip4/104....9z']
```

A great source of [examples][] can be found in the tests for this API.

## `ipfs.bootstrap.list([options])`

> List all peer addresses in the bootstrap list
@@ -113,27 +162,64 @@ console.log(res.Peers)

A great source of [examples][] can be found in the tests for this API.

## `ipfs.bootstrap.rm([addr,] [options])`
## `ipfs.bootstrap.rm(addr, [options])`

> Remove a peer address from the bootstrap list
### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| addr | [MultiAddr][] | The address of a network peer. If omitted the `all` option must be passed as `true`. |
| addr | [MultiAddr][] | The address of a network peer |

### Options

An optional object which may have the following keys:

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| all | `boolean` | `false` | If true, remove all peers from the bootstrap list |
| 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 |

Note: If passing the `all` option, `addr` is an optional parameter (may be `undefined`/`null`) and options may be passed as the first argument. i.e. `ipfs.bootstrap.rm({ all: true })`
### Returns

| Type | Description |
| -------- | -------- |
| `Promise<{ Peers: Array<MultiAddr> }>` | An object that contains an array with all the removed addresses |

```JavaScript
{
Peers: [address1, address2, ...]
}
```

### Example

```JavaScript
const res = await ipfs.bootstrap.rm('address1')
console.log(res.Peers)
// Logs:
// [address1, ...]
```

A great source of [examples][] can be found in the tests for this API.

## `ipfs.bootstrap.clear([options])`

> Remove all peer addresses from the bootstrap list
### Parameters

None.

### Options

An optional object which may have the following keys:

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| 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 |

### Returns

@@ -150,7 +236,7 @@ Note: If passing the `all` option, `addr` is an optional parameter (may be `unde
### Example

```JavaScript
const res = await ipfs.bootstrap.rm(null, { all: true })
const res = await ipfs.bootstrap.clear()
console.log(res.Peers)
// Logs:
// [address1, address2, ...]
Loading