Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-07-29 09:09:34 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-07-29 09:09:34 +0300
commite07939dc1b4b036b6ab4344476cff6afbda76fa8 (patch)
tree4c853927dde776752aea85ca1f573ee4e641d518 /docs/get-started.md
parent2be09cc2fabef37ddba365fb0b014d719fbb8fff (diff)
fix docs (fixes #861)
Diffstat (limited to 'docs/get-started.md')
-rw-r--r--docs/get-started.md17
1 files changed, 3 insertions, 14 deletions
diff --git a/docs/get-started.md b/docs/get-started.md
index 366c891..7e13014 100644
--- a/docs/get-started.md
+++ b/docs/get-started.md
@@ -88,25 +88,14 @@ This exports a `DragDrop` function on `window`.
```js
var WebTorrent = require('webtorrent')
-var fs = require('fs')
var client = new WebTorrent()
var magnetURI = 'magnet:...'
-client.add(magnetURI, function (torrent) {
- torrent.files.forEach(function (file) {
- console.log('Started saving ' + file.name)
-
- file.getBuffer(function (err, buffer) {
- if (err) {
- console.error('Error downloading ' + file.name)
- return
- }
- fs.writeFile(file.name, buffer, function (err) {
- console.error('Error saving ' + file.name)
- })
- })
+client.add(magnetURI, { path: '/path/to/folder' }, function (torrent) {
+ torrent.on('done', function () {
+ console.log('torrent download finished')
})
})
```