docs: ipfs-http-client -> kubo-rpc-client (#9331)

Fixes https://github.com/ipfs/js-kubo-rpc-client/issues/35

Co-authored-by: Steve Loeppky <stvn@loeppky.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
This commit is contained in:
Russell Dempsey 2022-11-22 14:19:27 -08:00 committed by GitHub
parent 1e90efb75d
commit a32128d1d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 17 deletions

View File

@ -378,6 +378,10 @@ Basic proof of 'ipfs working' locally:
# QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
ipfs cat <that hash>
### HTTP/RPC clients
For programmatic interaction with Kubo, see our [list of HTTP/RPC clients](docs/http-rpc-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.

14
docs/http-rpc-clients.md Normal file
View File

@ -0,0 +1,14 @@
# HTTP/RPC Clients
Kubo provides official HTTP RPC (`/api/v0`) clients for selected lanaguages:
- [js-kubo-rpc-client](https://github.com/ipfs/js-kubo-rpc-client) - Official JS client for talking to Kubo RPC over HTTP
- [go-ipfs-api](https://github.com/ipfs/go-ipfs-api) - The go interface to ipfs's HTTP RPC - Follow https://github.com/ipfs/kubo/issues/9124 for coming changes.
- [go-ipfs-http-client](https://github.com/ipfs/go-ipfs-http-client) - IPFS CoreAPI implementation using HTTP RPC - Follow https://github.com/ipfs/kubo/issues/9124 for coming changes.
## 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 |

View File

@ -76,28 +76,12 @@ 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 RPC clients here](http-rpc-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
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
## Note on multipart + inspecting requests
Despite all the generalization spoken about above, the IPFS API is actually very