Skip to content

Commit 933ea01

Browse files
authored
docs: consolidate and update docs (#3364)
* Consolidates docs under `/docs` * Adds missing licenses, CoC, READMEs, etc * Updates docs where information was incorrect
1 parent 396a9d2 commit 933ea01

File tree

1 file changed

+22
-87
lines changed

1 file changed

+22
-87
lines changed

README.md

Lines changed: 22 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,15 @@
2929

3030
> A client library for the IPFS HTTP API, implemented in JavaScript. This client library implements the IPFS [Core API](https://github.com/ipfs/js-ipfs/tree/master/docs/api) enabling applications to change between an embedded js-ipfs node and any remote IPFS node without having to change the code. In addition, this client library implements a set of utility functions.
3131
32-
## Getting started
33-
34-
* Look into the [examples](https://github.com/ipfs/js-ipfs/tree/master/examples) to learn how to spawn an IPFS node in Node.js and in the Browser
35-
* Read the [Core API docs](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) to see what you can do with an IPFS node
36-
* Visit https://dweb-primer.ipfs.io to learn about IPFS and the concepts that underpin it
37-
* Head over to https://proto.school to take interactive tutorials that cover core IPFS APIs
38-
* Check out https://docs.ipfs.io for tips, how-tos and more
39-
40-
## Lead Maintainer
32+
## Lead Maintainer <!-- omit in toc -->
4133

4234
[Alex Potsides](http://github.com/achingbrain)
4335

44-
## Table of Contents
36+
## Table of Contents <!-- omit in toc -->
4537

46-
- [Getting started](#getting-started)
47-
- [Lead Maintainer](#lead-maintainer)
48-
- [Table of Contents](#table-of-contents)
49-
- [Install](#install)
38+
- [Getting Started](#getting-started)
39+
- [Install](#install)
40+
- [Next Steps](#next-steps)
5041
- [Usage](#usage)
5142
- [API](#api)
5243
- [Additional Options](#additional-options)
@@ -58,12 +49,9 @@
5849
- [URL source](#url-source)
5950
- [`urlSource(url)`](#urlsourceurl)
6051
- [Example](#example-1)
61-
- [IPLD Formats](#ipld-formats)
6252
- [Running the daemon with the right port](#running-the-daemon-with-the-right-port)
6353
- [Importing the module and usage](#importing-the-module-and-usage)
64-
- [Importing a sub-module and usage](#importing-a-sub-module-and-usage)
6554
- [In a web browser](#in-a-web-browser)
66-
- [CORS](#cors)
6755
- [Custom Headers](#custom-headers)
6856
- [Global Timeouts](#global-timeouts)
6957
- [Development](#development)
@@ -72,7 +60,11 @@
7260
- [Historical context](#historical-context)
7361
- [License](#license)
7462

75-
## Install
63+
## Getting Started
64+
65+
We've come a long way, but this project is still in Alpha, lots of development is happening, APIs might change, beware of 🐉..
66+
67+
### Install
7668

7769
This module uses node.js, and can be installed through npm:
7870

@@ -82,13 +74,24 @@ npm install --save ipfs-http-client
8274

8375
Both the Current and Active LTS versions of Node.js are supported. Please see [nodejs.org](https://nodejs.org/) for what these currently are.
8476

77+
### Next Steps
78+
79+
* Read the [docs](https://github.com/ipfs/js-ipfs/tree/master/docs)
80+
* Look into the [examples](https://github.com/ipfs/js-ipfs/tree/master/examples) to learn how to spawn an IPFS node in Node.js and in the Browser
81+
* Consult the [Core API docs](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) to see what you can do with an IPFS node
82+
* Visit https://dweb-primer.ipfs.io to learn about IPFS and the concepts that underpin it
83+
* Head over to https://proto.school to take interactive tutorials that cover core IPFS APIs
84+
* Check out https://docs.ipfs.io for tips, how-tos and more
85+
* See https://blog.ipfs.io for news and more
86+
* Need help? Please ask 'How do I?' questions on https://discuss.ipfs.io
87+
8588
## Usage
8689

8790
### API
8891

8992
[![IPFS Core API Compatible](https://cdn.rawgit.com/ipfs/interface-ipfs-core/master/img/badge.svg)](https://github.com/ipfs/js-ipfs/tree/master/packages/interface-ipfs-core)
9093

91-
> `js-ipfs-http-client` implements the [IPFS Core API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) - please follow the previous link to see the the methods available.
94+
> `js-ipfs-http-client` implements the [IPFS Core API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) - please follow the previous link to see the methods available.
9295
9396
### Additional Options
9497

@@ -107,7 +110,6 @@ Call this on your client instance to return an object containing the `host`, `po
107110

108111
Aside from the default export, `ipfs-http-client` exports various types and utilities that are included in the bundle:
109112

110-
- [`Buffer`](https://www.npmjs.com/package/buffer)
111113
- [`multiaddr`](https://www.npmjs.com/package/multiaddr)
112114
- [`multibase`](https://www.npmjs.com/package/multibase)
113115
- [`multicodec`](https://www.npmjs.com/package/multicodec)
@@ -192,53 +194,6 @@ console.log(file)
192194
*/
193195
```
194196

195-
### IPLD Formats
196-
197-
By default an instance of the client supports the following [IPLD formats](https://github.com/ipld/interface-ipld-format), which are enough to do all core IPFS operations:
198-
199-
* [dag-pb](https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-pb.md)
200-
* [dag-cbor](https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-cbor.md)
201-
* [raw](https://github.com/ipld/specs/issues/223)
202-
203-
If your application requires support for extra codecs, you can configure them as follows:
204-
205-
1. Configure the [IPLD layer](https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs/docs/MODULE.md#optionsipld) of your IPFS daemon to support the codec. This step is necessary so the node knows how to prepare data received over HTTP to be passed to IPLD for serialization:
206-
```javascript
207-
const ipfs = require('ipfs')
208-
209-
const node = await ipfs({
210-
ipld: {
211-
// either specify them as part of the `formats` list
212-
formats: [
213-
require('my-format')
214-
],
215-
216-
// or supply a function to load them dynamically
217-
loadFormat: async (format) => {
218-
return require(format)
219-
}
220-
}
221-
})
222-
2. Configure your IPFS HTTP API Client to support the codec. This is necessary so that the client can send the data to the IPFS node over HTTP:
223-
```javascript
224-
const ipfsHttpClient = require('ipfs-http-client')
225-
226-
const client = ipfsHttpClient({
227-
url: 'http://127.0.0.1:5002',
228-
ipld: {
229-
// either specify them as part of the `formats` list
230-
formats: [
231-
require('my-format')
232-
],
233-
234-
// or supply a function to load them dynamically
235-
loadFormat: async (format) => {
236-
return require(format)
237-
}
238-
}
239-
})
240-
```
241-
242197
### Running the daemon with the right port
243198

244199
To interact with the API, you need to have a local daemon running. It needs to be open on the right port. `5001` is the default, and is used in the examples below, but it can be set to whatever you need.
@@ -273,15 +228,6 @@ const ipfs = ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' })
273228
const ipfs = ipfsClient({ host: '1.1.1.1', port: '80', apiPath: '/ipfs/api/v0' })
274229
```
275230

276-
### Importing a sub-module and usage
277-
278-
```javascript
279-
const bitswap = require('ipfs-http-client/src/bitswap')('/ip4/127.0.0.1/tcp/5001')
280-
281-
const list = await bitswap.wantlist()
282-
// ...
283-
```
284-
285231
### In a web browser
286232

287233
**through Browserify**
@@ -331,17 +277,6 @@ If you omit the host and port, the client will parse `window.host`, and use this
331277
const ipfs = window.IpfsHttpClient()
332278
```
333279

334-
### CORS
335-
336-
In a web browser IPFS HTTP client (either browserified or CDN-based) might encounter an error saying that the origin is not allowed. This would be a CORS ("Cross Origin Resource Sharing") failure: IPFS servers are designed to reject requests from unknown domains by default. You can whitelist the domain that you are calling from by changing your ipfs config like this:
337-
338-
```console
339-
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://example.com"]'
340-
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]'
341-
```
342-
343-
If you are using `js-ipfs`, substitute `ipfs` for `jsipfs` in the commands above.
344-
345280
### Custom Headers
346281

347282
If you wish to send custom headers with each request made by this library, for example, the Authorization header. You can use the config to do so:

0 commit comments

Comments
 (0)