webtorrent: end-of-stream >=1.4.2 update creates a "premature close" error on seed() when using a W3C File input

What version of this package are you using? 0.107.16

What operating system, Node.js, and npm version? Mac OS 10.14.6 / Chrome 77.0.3865.90 or Safari 13 / Node 12.0.0 / npm 6.11.3

What happened? On browser, when I call the seed method using a W3C File input, “end-of-stream” is throwing an error :

error Error: premature close
    at onclosenexttick (webtorrent.min.js:12485)
    at Item.run (webtorrent.min.js:3160)
    at drainQueue (webtorrent.min.js:3130)

It adds the torrent in the WebTorrent client but the torrent.files === [] and torrent.done === false.

If I put the 1.4.1 end-of-stream package, there is no problem.

What did you expect to happen? And the torrent.files should contain the input data and torrent.done should be true.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@umbra-scientia Webtorrent just requires ^1.1.0 so what I ended up doing was explicitly requiring end-of-stream@1.4.1 in my dependencies, and that solved the problem for me. Hope it helps

yeah, works on my laptop but not my phone for some reason.

I don’t have any control over instant.io, but here’s a version on glitch.com that uses these PRs (that eliminate multistream as a dependency) https://github.com/webtorrent/create-torrent/pull/115, and https://github.com/webtorrent/webtorrent/pull/1832.

Nothing else is changed from the instant.io master branch except pulling those PRs from github for webtorrent and create-torrent

I also tried with just the create-torrent PR, so pinning end of stream in webtorrent seems to work.