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.
[](https://saucelabs.com/u/ipfs-js-api)
16
-
17
-
> **Note: If you see CI red, that is due a failing test when adding nested directories in the browser, all the other features work as expect, if this is something you also need, please consider helping us identifying the solution for it, join the discussion at: https://github.com/ipfs/js-ipfs-api/issues/339**
15
+
<!-- Hidding this until we have the SauceLabs situation figured out.
16
+
[](https://saucelabs.com/u/ipfs-js-api)
17
+
-->
18
18
19
19
> A client library for the IPFS HTTP API, implemented in JavaScript. This client library implements the [interface-ipfs-core](https://github.com/ipfs/interface-ipfs-core) enabling applications to change between a embebed 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.
20
20
@@ -39,25 +39,25 @@ ipfs-api
39
39
This module uses node.js, and can be installed through npm:
40
40
41
41
```bash
42
-
$ npm install --save ipfs-api
42
+
> npm install --save ipfs-api
43
43
```
44
44
45
-
**Note:** ipfs-api requires Node v4.x (LTS) or higher.
45
+
**Note:** ipfs-api requires Node.js v4 (LTS) or higher.
46
46
47
47
### Running the daemon with the right port
48
48
49
49
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.
50
50
51
51
```sh
52
52
# Show the ipfs config API port to check it is correct
> `js-ipfs-api` follows the spec defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), which concerns the interface to expect from IPFS implementations. This interface is a currently active endeavor - expect it to be complete in the next few weeks (August 2016). You can use it today to consult the methods available.
140
+
> `js-ipfs-api` follows the spec defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), which concerns the interface to expect from IPFS implementations. This interface is a currently active endeavor. You can use it today to consult the methods available.
141
+
142
+
#### Caveats
143
+
144
+
##### Pubsub
145
+
146
+
**Currently, the [PubSub API only works in Node.js envinroment](https://github.com/ipfs/js-ipfs-api/issues/518)**
147
+
148
+
We currently don't support pubsub when run in the browser, and we test it with separate set of tests to make sure if it's being used in the browser, pubsub errors.
149
+
150
+
More info: https://github.com/ipfs/js-ipfs-api/issues/518
151
+
152
+
This means:
153
+
- You can use pubsub from js-ipfs-api in Node.js
154
+
- You can use pubsub from js-ipfs-api in Electron
155
+
(when js-ipfs-api is ran in the main process of Electron)
156
+
- You can't use pubsub from js-ipfs-api in the browser
157
+
- You can't use pubsub from js-ipfs-api in Electron's
158
+
renderer process
159
+
- You can use pubsub from js-ipfs in the browsers
160
+
- You can use pubsub from js-ipfs in Node.js
161
+
- You can use pubsub from js-ipfs in Electron
162
+
(in both the main process and the renderer process)
163
+
- See https://github.com/ipfs/js-ipfs for details on
@@ -150,10 +287,13 @@ Complete documentation for these methods is coming with: https://github.com/ipfs
150
287
151
288
> `ipfs.util.addFromFs(path, option, callback)`
152
289
153
-
Reads a file from `path` on the filesystem and adds it to IPFS. If `path` is a directory, use option `{ recursive: true }` to add the directory and all its sub-directories.
290
+
Reads a file or folder from `path` on the filesystem and adds it to IPFS. Options:
291
+
-**recursive**: If `path` is a directory, use option `{ recursive: true }` to add the directory and all its sub-directories.
292
+
-**ignore**: To exclude fileglobs from the directory, use option `{ ignore: ['ignore/this/folder/**', 'and/this/file'] }`.
293
+
-**hidden**: hidden/dot files (files or folders starting with a `.`, for example, `.git/`) are not included by default. To add them, use the option `{ hidden: true }`.
0 commit comments