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 Feb 12, 2024. It is now read-only.
@@ -138,18 +107,17 @@ In order to use js-ipfs as a CLI, you must install it with the `global` flag. Ru
138
107
$ npm install ipfs --global
139
108
```
140
109
141
-
The CLI is available by using the command `jsipfs` in your terminal. This is aliased, instead of using `ipfs`, to make sure it does not conflict with the Go implementation.
142
-
143
-
### Use in the browser with browserify, webpack or any bundler
110
+
The CLI is available by using the command `jsipfs` in your terminal. This is aliased, instead of using `ipfs`, to make sure it does not conflict with the [Go implementation](https://github.com/ipfs/go-ipfs).
144
111
145
-
You can find examples of how to do this bundling at: `https://github.com/ipfs/js-ipfs/tree/master/examples`. If you are using webpack, make sure to use version 2 or above, otherwise it won't work.
112
+
### Use in the browser
146
113
147
-
###Use in a browser using a script tag
114
+
##### With browserify, webpack or any bundler
148
115
149
-
Loading this module in a browser (using a `<script>` tag) makes the `Ipfs` object available in the global namespace.
116
+
Find examples of how to do this bundling at: `https://github.com/ipfs/js-ipfs/tree/master/examples`. If you are using webpack, make sure to use version 2 or above, otherwise it won't work.
150
117
151
-
The last published version of the package become [available for download](https://unpkg.com/ipfs/dist/) from [unpkg](https://unpkg.com/) and thus you may use it as the source:
118
+
##### With script tag
152
119
120
+
Loading this module in a browser (using a `<script>` tag) makes the `Ipfs` object available in the global namespace. The last published version of the package become [available for download](https://unpkg.com/ipfs/dist/) from [unpkg](https://unpkg.com/) and thus you may use it as the source:
153
121
154
122
```html
155
123
<!-- loading the minified version -->
@@ -186,6 +154,14 @@ Commands:
186
154
- default API port: `5002`
187
155
- default Bootstrap is off, to enable it set `IPFS_BOOTSTRAP=1`
188
156
157
+
If you want to use WebRTC in your local daemon, you will need to install it separatly by installing globally one of the following modules:
This is a separate step because there isn't still a good open source WebRTC implementation for Node.js that runs in all the envinronments correctly.
163
+
Example: `npm install electron-webrtc --global`.
164
+
189
165
### HTTP-API
190
166
191
167
The HTTP-API exposed by the js-ipfs daemon follows the [`http-api-spec`](https://github.com/ipfs/http-api-spec). You can use any of the IPFS HTTP-API client libraries with it, such as: [js-ipfs-api](https://github.com/ipfs/js-ipfs-api).
@@ -220,6 +196,11 @@ When starting a node, you can:
220
196
// https://github.com/ipfs/js-ipfs-repo
221
197
constrepo=<IPFS Repo instance or repo path>
222
198
199
+
// If you want to use the WebRTC transport in Node.js, you have to add it separately. Note, WebRTC comes out of the box in the Browser!
200
+
constwrtc=require('wrtc') // or require('electron-webrtc')()
201
+
constWStar=require('libp2p-webrtc-star')
202
+
constwstar=WStar({ wrtc: wrtc })
203
+
223
204
constnode=newIPFS({
224
205
repo: repo,
225
206
init:true, // default
@@ -241,6 +222,12 @@ const node = new IPFS({
241
222
'/ip4/127.0.0.1/tcp/1337'
242
223
]
243
224
}
225
+
},
226
+
libp2p: { // add custom modules to the libp2p stack of your node
227
+
modules: { // here we show how to add WebRTC. Note, WebRTC comes out of the box in the Browser! You just need to do this for Node.js
> This example is heavily inspired by [electron-quick-start](https://github.com/electron/electron-quick-start).
4
+
5
+
**DISCLAIMER:** This example is still a work in progress, it currently doesn't work due to the usage of native dependencies that Electron is not supporting.
6
+
7
+
To try it by yourself, do:
8
+
9
+
```
10
+
> npm install
11
+
> ./node_modules/.bin/electron-rebuild
12
+
# or
13
+
> ./build.sh
14
+
#
15
+
# You can also try to use `npm start` to see where electron errors
0 commit comments