diff options
Diffstat (limited to 'examples/browser-seed.js')
-rw-r--r-- | examples/browser-seed.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/browser-seed.js b/examples/browser-seed.js new file mode 100644 index 0000000..6a6d498 --- /dev/null +++ b/examples/browser-seed.js @@ -0,0 +1,12 @@ +var dragDrop = require('drag-drop/buffer')
+var WebTorrent = require('webtorrent')
+
+var client = new WebTorrent()
+
+// When user drops files on the browser, create a new torrent and start seeding it!
+dragDrop('body', function (files) {
+ client.seed(files, function onTorrent (torrent) {
+ // Client is seeding the file!
+ console.log('Torrent info hash:', torrent.infoHash)
+ })
+})
|