New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve docs #694
Improve docs #694
Changes from all commits
8c6810a
59a2ecf
9c9bfc9
418b667
19cd49b
caf2ce4
5f90276
8a3cde6
8ce5dd0
155ca7b
File filter...
Jump to…
| @@ -142,12 +142,10 @@ standards (no plugins, just HTML5 and WebRTC)! It's easy to get started! | ||
| ##### Downloading a file is simple: | ||
|
|
||
| ```js | ||
| var WebTorrent = require('webtorrent') | ||
| var client = new WebTorrent() | ||
| var magnetURI = '...' | ||
| var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4' | ||
FluorescentHallucinogen
Author
Contributor
|
||
| client.add(magnetURI, function (torrent) { | ||
| client.add(torrentId, function (torrent) { | ||
| // Got torrent metadata! | ||
| console.log('Client is downloading:', torrent.infoHash) | ||
| @@ -161,10 +159,15 @@ client.add(magnetURI, function (torrent) { | ||
|
|
||
| ##### Seeding a file is simple, too: | ||
|
|
||
| ```js | ||
| var dragDrop = require('drag-drop') | ||
| var WebTorrent = require('webtorrent') | ||
| This example uses the [`drag-drop`][drag-drop] package, to make the HTML5 Drag and | ||
| Drop API easier to work with. | ||
|
|
||
| To start using `drag-drop`, simply include the | ||
| `dragdrop.min.js` script on your page. This exports a `dragDrop` function on `window`. | ||
| If you use [browserify](http://browserify.org), you can | ||
| `npm install drag-drop` and then use like this `var dragDrop = require('drag-drop')`. | ||
|
|
||
| ```js | ||
| var client = new WebTorrent() | ||
| // When user drops files on the browser, create a new torrent and start seeding it! | ||
| @@ -266,7 +269,14 @@ There are many supported streaming options: | ||
| --stdout standard out [implies --quiet] | ||
| ``` | ||
|
|
||
| In addition to magnet uris, webtorrent supports [many ways to specify a torrent](#clientaddtorrentid-opts-function-ontorrent-torrent-). | ||
| In addition to magnet uris, webtorrent supports many ways to specify a torrent: | ||
|
|
||
| - magnet uri (string) | ||
| - torrent file (buffer) | ||
| - info hash (hex string or buffer) | ||
| - parsed torrent (from [parse-torrent](https://github.com/feross/parse-torrent)) | ||
| - http/https url to a torrent file (string) | ||
| - filesystem path to a torrent file (string) | ||
|
|
||
| ### Modules | ||
|
|
||
That's a magnet uri. What is a torrent id ?