diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-03-25 05:22:49 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-03-25 05:22:49 +0300 |
commit | 03ef03c6d5c527eef05086502bbe1e4856c6aecb (patch) | |
tree | ff9481acf218608a0d4c905fd30602c189b4dc30 /docs/api.md | |
parent | fa74f4f74e749e8c1b8dfc560a563b2562ba6300 (diff) |
merge quick-start.md into api.md
Diffstat (limited to 'docs/api.md')
-rw-r--r-- | docs/api.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/api.md b/docs/api.md index 94cb519..b613d2d 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,3 +1,34 @@ +# WebTorrent Documentation + +WebTorrent is a streaming torrent client for **Node.js** and the **web**. WebTorrent +provides the same API in both environments. + +To use WebTorrent in the browser, [WebRTC] support is required (Chrome, Firefox, Opera). + +[webrtc]: https://en.wikipedia.org/wiki/WebRTC + +## Install + +```bash +npm install webtorrent +``` + +## Quick Example + +```js +var client = new WebTorrent() + +var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d' + +client.add(torrentId, function (torrent) { + // Torrents can contain many files. Let's use the first. + var file = torrent.files[0] + + // Display the file by adding it to the DOM. Supports video, audio, image, etc. files + file.appendTo('body') +}) +``` + # WebTorrent API ## `WebTorrent.WEBRTC_SUPPORT` |