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
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
> A client library for the IPFS HTTP API, implemented in JavaScript.
10
13
11
-
#Usage
14
+
## Table of Contents
12
15
13
-
## Installing the module
16
+
-[Install](#install)
17
+
-[Running the daemon with the right port](#running-the-daemon-with-the-right-port)
18
+
-[Importing the module and usage](#importing-the-module-and-usage)
19
+
-[In the Browser through browserify](#in-the-browser-through-browserify)
20
+
-[In the Browser through `<script>` tag](#in-the-browser-through-script-tag)
21
+
-[CORS](#cors)
22
+
-[Usage](#usage)
23
+
-[Callbacks and promises](#callbacks-and-promises)
24
+
-[Contribute](#contribute)
25
+
-[License](#license)
14
26
15
-
### In Node.js Through npm
27
+
## Install
28
+
29
+
This module uses node.js, and can be installed through npm:
16
30
17
31
```bash
18
32
$ npm install --save ipfs-api
19
33
```
34
+
20
35
**Note:** ipfs-api requires Node v4.x (LTS) or higher.
21
36
22
-
####Running the daemon with the right port
37
+
### Running the daemon with the right port
23
38
24
39
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.
@@ -74,7 +89,7 @@ If you omit the host and port, the api will parse `window.host`, and use this in
74
89
var ipfs = window.IpfsApi()
75
90
```
76
91
77
-
## CORS
92
+
###CORS
78
93
79
94
If are using this module in a browser with something like browserify, then you will get an error saying that the origin is not allowed. This would be a CORS ("Cross Origin Resource Sharing") failure. The ipfs server rejects requests from unknown domains by default. You can whitelist the domain that you are calling from by changing your ipfs config like this:
80
95
@@ -112,10 +127,10 @@ The js-ipfs API is a work in progress. As such, there's a few things you can do
112
127
***Add tests**. There can never be enough tests.
113
128
***Contribute to the [FAQ repository](https://github.com/ipfs/faq/issues)** with any questions you have about IPFS or any of the relevant technology. A good example would be asking, 'What is a merkledag tree?'. If you don't know a term, odds are, someone else doesn't either. Eventually, we should have a good understanding of where we need to improve communications and teaching together to make IPFS and IPN better.
0 commit comments