Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support `FileList` as input for the `seed` method #153

Merged
merged 1 commit into from Oct 19, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

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.
  • Loading branch information
valeriangalliat committed Oct 18, 2014
commit c3803b52735245a2e9240e8ba18c0198fb47bf72
@@ -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
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.