From c3803b52735245a2e9240e8ba18c0198fb47bf72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Galliat?= Date: Sat, 18 Oct 2014 11:03:26 +0200 Subject: [PATCH] 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. --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 26e1eefb..209d9f33 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