From e07939dc1b4b036b6ab4344476cff6afbda76fa8 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 28 Jul 2016 23:09:34 -0700 Subject: fix docs (fixes #861) --- docs/get-started.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'docs/get-started.md') 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') }) }) ``` -- cgit v1.2.3