You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-87Lines changed: 22 additions & 87 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,24 +29,15 @@
29
29
30
30
> 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.
31
31
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 -->
41
33
42
34
[Alex Potsides](http://github.com/achingbrain)
43
35
44
-
## Table of Contents
36
+
## Table of Contents<!-- omit in toc -->
45
37
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)
50
41
-[Usage](#usage)
51
42
-[API](#api)
52
43
-[Additional Options](#additional-options)
@@ -58,12 +49,9 @@
58
49
-[URL source](#url-source)
59
50
-[`urlSource(url)`](#urlsourceurl)
60
51
-[Example](#example-1)
61
-
-[IPLD Formats](#ipld-formats)
62
52
-[Running the daemon with the right port](#running-the-daemon-with-the-right-port)
63
53
-[Importing the module and usage](#importing-the-module-and-usage)
64
-
-[Importing a sub-module and usage](#importing-a-sub-module-and-usage)
65
54
-[In a web browser](#in-a-web-browser)
66
-
-[CORS](#cors)
67
55
-[Custom Headers](#custom-headers)
68
56
-[Global Timeouts](#global-timeouts)
69
57
-[Development](#development)
@@ -72,7 +60,11 @@
72
60
-[Historical context](#historical-context)
73
61
-[License](#license)
74
62
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
76
68
77
69
This module uses node.js, and can be installed through npm:
Both the Current and Active LTS versions of Node.js are supported. Please see [nodejs.org](https://nodejs.org/) for what these currently are.
84
76
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
+
85
88
## Usage
86
89
87
90
### API
88
91
89
92
[](https://github.com/ipfs/js-ipfs/tree/master/packages/interface-ipfs-core)
90
93
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.
92
95
93
96
### Additional Options
94
97
@@ -107,7 +110,6 @@ Call this on your client instance to return an object containing the `host`, `po
107
110
108
111
Aside from the default export, `ipfs-http-client` exports various types and utilities that are included in the bundle:
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:
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
-
constipfs=require('ipfs')
208
-
209
-
constnode=awaitipfs({
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
-
returnrequire(format)
219
-
}
220
-
}
221
-
})
222
-
2. Configure your IPFSHTTPAPI Client to support the codec. This is necessary so that the client can send the data to the IPFS node over HTTP:
// 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
-
242
197
### Running the daemon with the right port
243
198
244
199
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.
@@ -331,17 +277,6 @@ If you omit the host and port, the client will parse `window.host`, and use this
331
277
constipfs=window.IpfsHttpClient()
332
278
```
333
279
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:
0 commit comments