diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-03-17 02:51:48 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-03-17 02:51:48 +0300 |
commit | 1339332582844b251ae479445438e89c599d5ba5 (patch) | |
tree | 25d7370467f745ed12e66cd22d989d5800ea375f /README.md | |
parent | 4655af9874de61ced87967a4af7f93fe1447f9bd (diff) | |
parent | cc4f08e9feac2874042d30459e719ad5a832e02c (diff) |
Merge branch 'improve-integration-instructions' of https://github.com/Autarc/webtorrent into Autarc-improve-integration-instructions
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 42 |
1 files changed, 34 insertions, 8 deletions
@@ -66,7 +66,7 @@ connect to both normal *and* web peers. ### Features -- **Torrent client for node.js & the browser** (same npm module!) +- **Torrent client for node.js & the browser** (same npm package!) - **Insanely fast** - Download **multiple torrents** simultaneously, efficiently - **Pure Javascript** (no native dependencies) @@ -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: @@ -183,9 +179,35 @@ There are more examples in [docs/get-started.md](docs/get-started.md). ##### Browserify -WebTorrent works great with [browserify](http://browserify.org/), an npm module that let's +WebTorrent works great with [browserify](http://browserify.org/), an npm package 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 also works with [webpack](http://webpack.github.io/), a module bundler similar +to browserify. However, webpack requires the following extra configuration: + +```js +{ + target: 'web', + node: { + fs: 'empty' + }, + module: { + loaders: [ + // make sure to install the 'json-loader' package: npm install 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: @@ -203,7 +225,11 @@ MaxCDN) for easy inclusion on your site: #### In node.js -WebTorrent also works in node.js, using the *same npm module!* It's mad science! +WebTorrent also works in node.js, using the *same npm package!* 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 @@ -244,7 +270,7 @@ In addition to magnet uris, webtorrent supports [many ways to specify a torrent] ### Modules -Most of the active development is happening inside of small npm modules which are used by WebTorrent. +Most of the active development is happening inside of small npm packages which are used by WebTorrent. #### The Node Way™ |