diff options
author | Valérian Galliat <val@codejam.info> | 2014-10-18 13:03:26 +0400 |
---|---|---|
committer | Valérian Galliat <val@codejam.info> | 2014-10-18 13:03:26 +0400 |
commit | c3803b52735245a2e9240e8ba18c0198fb47bf72 (patch) | |
tree | 5b198d260027a183670182df5d5ef9874ee6eb3d /index.js | |
parent | 89013e2798e5ba6385b9b805fad1ef8addc818b3 (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.js | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 |