Skip to content

Commit

Permalink
docs: ipfs-http-client -> kubo-rpc-client
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Oct 5, 2022
1 parent 353e6a2 commit 2ded26f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ Basic proof of 'ipfs working' locally:
# QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
ipfs cat <that hash>

### HTTP clients

For programmatic interaction with Kubo, see our [list of HTTP/RPC clients](docs/http-clients.md).

### Troubleshooting

If you have previously installed IPFS before and you are running into problems getting a newer version to work, try deleting (or backing up somewhere else) your IPFS config directory (~/.ipfs by default) and rerunning `ipfs init`. This will reinitialize the config file to its defaults and clear out the local datastore of any bad entries.
Expand Down
17 changes: 17 additions & 0 deletions docs/http-clients.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# HTTP Clients

To date, we have four different HTTP API clients:

- [kubo-rpc-client](https://github.com/ipfs/js-kubo-rpc-client) - Official JS client for talking to Kubo over HTTP
- [ipfs-http-client](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client) - http client for js-ipfs -- Use when talking to [`js-ipfs`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs)
- [go-ipfs-api](https://github.com/ipfs/go-ipfs-api) - The go interface to ipfs's HTTP API
- [go-ipfs-http-client](https://github.com/ipfs/go-ipfs-http-client) - IPFS CoreAPI implementation using HTTP API
- [kubo/commands/http](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/commands/http) -
generalized transport based on the [command definitions](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/core/commands)

## Recommended clients

| Language | Package Name | Github Repository |
|:--------:|:-------------------:|---------------------------------------------|
| JS | kubo-rpc-client | https://github.com/ipfs/js-kubo-rpc-client |
| Go | go-ipfs-http-client | https://github.com/ipfs/go-ipfs-http-client |
21 changes: 6 additions & 15 deletions docs/implement-api-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,18 @@ As mentioned above, the API commands map to HTTP with:
- the request body streams file data - reads files or stdin
- multiple streams are muxed with multipart (todo: add tar stream support)

To date, we have two different HTTP API clients:

- [js-ipfs-api](https://github.com/ipfs/js-ipfs-api) - simple javascript
wrapper -- best to look at
- [kubo/commands/http](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/commands/http) -
generalized transport based on the [command definitions](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/core/commands)
You can see the latest [list of our HTTP clients here](http-clients.md)

The Go implementation is good to answer harder questions, like how is multipart
handled, or what headers should be set in edge conditions. But the javascript
implementation is very concise, and easy to follow.

#### Anatomy of node-ipfs-api
#### Anatomy of `kubo-rpc-client`

Currently, node-ipfs-api has three main files
- [src/index.js](https://github.com/ipfs-inactive/js-ipfs-http-client/blob/66d1462bd02181d46e8baf4cd9d476b213426ad8/src/index.js) defines the functions clients of the API
module will use. uses `RequestAPI`, and translates function call parameters to
the API almost directly.
- [src/get-files-stream.js](https://github.com/ipfs-inactive/js-ipfs-http-client/blob/66d1462bd02181d46e8baf4cd9d476b213426ad8/src/get-files-stream.js) implements the hardest part:
file streaming. This one uses multipart.
- [src/request-api.js](https://github.com/ipfs-inactive/js-ipfs-http-client/blob/66d1462bd02181d46e8baf4cd9d476b213426ad8/src/request-api.js) generic function call to perform
the actual HTTP requests
Currently, `kubo-rpc-client` has one main file, and folders where subcommands are implemented
- [`src/index.js`](https://github.com/ipfs/js-kubo-rpc-client/blob/ef63c43a8dcc44d94683ed353def3ef906a6ffb5/src/index.js#L105-L143) defines the functions clients of the API
module will use. Translates function call parameters to the API almost directly.
- [`src/*/*.js`](https://github.com/ipfs/js-kubo-rpc-client/tree/ef63c43a8dcc44d94683ed353def3ef906a6ffb5/src) folders within `src/` contain the logic for the relevant subcommand.

## Note on multipart + inspecting requests

Expand Down

0 comments on commit 2ded26f

Please sign in to comment.