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:
authorValérian Galliat <val@codejam.info>2014-10-18 13:03:26 +0400
committerValérian Galliat <val@codejam.info>2014-10-18 13:03:26 +0400
commitc3803b52735245a2e9240e8ba18c0198fb47bf72 (patch)
tree5b198d260027a183670182df5d5ef9874ee6eb3d /index.js
parent89013e2798e5ba6385b9b805fad1ef8addc818b3 (diff)
Support `FileList` as input for the `seed` method
The W3C `FileList` object has no `map` method, thus it needs to be converted to an array before using.
Diffstat (limited to 'index.js')
-rw-r--r--index.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/index.js b/index.js
index 26e1eef..209d9f3 100644
--- a/index.js
+++ b/index.js
@@ -199,6 +199,11 @@ WebTorrent.prototype.seed = function (input, opts, onseed) {
onseed = opts
opts = {}
}
+
+ if (typeof FileList === 'function' && input instanceof FileList) {
+ input = Array.prototype.slice.call(input)
+ }
+
// TODO: support `input` as filesystem path string
var buffer = Buffer.concat(input.map(function (file) {
return file.buffer