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:
Diffstat (limited to 'examples/browser-seed.js')
-rw-r--r--examples/browser-seed.js12
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)
+ })
+})