From 2552c4ba74dbdc5d648b9fe22068e188a8d8c37d Mon Sep 17 00:00:00 2001 From: Autarc Date: Wed, 16 Mar 2016 15:30:41 +0100 Subject: [PATCH 1/3] move reference from features to setup --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5aaca164..f0c34344 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,6 @@ connect to both normal *and* web peers. - Stream to **AirPlay**, **Chromecast**, **VLC player**, and many other devices/players -**NOTE**: To connect to "web peers" (browsers) in addition to normal BitTorrent peers, use - [webtorrent-hybrid](https://github.com/feross/webtorrent-hybrid) which includes WebRTC - support for node. - ### Install To install WebTorrent for use in node or the browser with `require('webtorrent')`, run: @@ -211,6 +207,10 @@ MaxCDN) for easy inclusion on your site: WebTorrent also works in node.js, using the *same npm module!* It's mad science! +**NOTE**: To connect to "web peers" (browsers) in addition to normal BitTorrent peers, use + [webtorrent-hybrid](https://github.com/feross/webtorrent-hybrid) which includes WebRTC + support for node. + #### As a command line app WebTorrent is available as [a command line app](https://github.com/feross/webtorrent-cli). From f2cdea0684ea4341dfd01b3c1791dac51eea7973 Mon Sep 17 00:00:00 2001 From: Autarc Date: Wed, 16 Mar 2016 15:31:45 +0100 Subject: [PATCH 2/3] link wrtc alternative --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0c34344..98d77031 100644 --- a/README.md +++ b/README.md @@ -279,7 +279,7 @@ If `opts` is specified, then the default options (shown below) will be overridde peerId: String|Buffer, // Wire protocol peer ID (default=randomly generated) rtcConfig: Object, // RTCPeerConnection configuration object (default=STUN only) tracker: Boolean, // Whether or not to enable trackers (default=true) - wrtc: Object // Custom webrtc implementation (in node, specify the [wrtc](https://www.npmjs.com/package/wrtc) package) + wrtc: Object // Custom webrtc implementation (in node, specify the [wrtc](https://www.npmjs.com/package/wrtc) or [electron-webrtc](https://github.com/mappum/electron-webrtc) package) } ``` From cc4f08e9feac2874042d30459e719ad5a832e02c Mon Sep 17 00:00:00 2001 From: Autarc Date: Wed, 16 Mar 2016 15:33:39 +0100 Subject: [PATCH 3/3] add webpack instructions --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 98d77031..1009e182 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,30 @@ There are more examples in the [examples](https://github.com/feross/webtorrent/t WebTorrent works great with [browserify](http://browserify.org/), an npm module that let's you use [node](http://nodejs.org/)-style require() to organize your browser code and load modules installed by [npm](https://www.npmjs.com/) (as seen in the previous examples). +##### Webpack + +WebTorrent works also great with [webpack](http://webpack.github.io/), a module bundler similar to browserify that supports various files types. Although webpack uses the specified [browser-field](https://github.com/feross/webtorrent/blob/master/package.json#L10) to reference alternative packages for the browser, following configurations have to be done to bundle the code: +```js +{ + target: 'web', + node: { + fs: 'empty' + }, + module: { + loaders: [ + // requires you to install the 'json-loader' module first: npm install --save-dev json-loader + { + test: /\.json$/, + loader: 'json' + } + ] + } +} +``` +Otherwise you could also directly use the pre-built version via `require('webtorrent/webtorrent.min')`. + +#### Global + WebTorrent is also available as a standalone script ([`webtorrent.min.js`](webtorrent.min.js)) which exposes `WebTorrent` on the `window` object, so it can be used with just a script tag: