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

getBlob, getBlobURL don't work #1114

Closed
bachlx-bitmark opened this issue Apr 24, 2017 · 3 comments
Closed

getBlob, getBlobURL don't work #1114

bachlx-bitmark opened this issue Apr 24, 2017 · 3 comments

Comments

@bachlx-bitmark
Copy link

@bachlx-bitmark bachlx-bitmark commented Apr 24, 2017

What version of WebTorrent?
I use webtorrent version 0.98.18
What browser and version? (if using WebTorrent in the browser)
I use Chrome browser on macOS -version 57.0.2987.133 (64-bit)
What did you expect to happen?
After download done, I create link as you API document:

file.getBlobURL(function (err, url) {
  if (err) throw err
  var a = document.createElement('a')
  a.download = file.name
  a.href = url
  a.textContent = 'Download ' + file.name
  document.body.appendChild(a)
})

What actually happened?
It display an error:

webtorrent.min.js:1 Uncaught TypeError: Cannot read property 'get' of null
    at r._notify (webtorrent.min.js:1)
    at r._read (webtorrent.min.js:1)
    at r.i.read (webtorrent.min.js:6)
    at v (webtorrent.min.js:6)
    at webtorrent.min.js:5
    at c.run (webtorrent.min.js:5)
    at u (webtorrent.min.js:5)

I see in inspect of Chrome:
screen shot 2017-04-24 at 9 03 44 am

Note: web client use angular2
Please check help me.
Thanks!

@so010

This comment has been minimized.

Copy link

@so010 so010 commented Apr 24, 2017

It has to be the file object from the torrent which you get from webtorrentClient.add:

webtorrentClient = new WebTorrent()
webtorrentClient.add(magnetURI,function(torrent) {
  torrent.on('done', function () {
      console.log('torrent download finished from ',torrent.files[0].name)
      torrent.files[0].getBlobURL(function callback (err, url) {
        if (err) console.log('Error on getting torrent-file: ',torrent.files[0].name)
        var a = document.createElement('a')
        a.download = torrent.files[0].name
        a.href = url
        a.textContent = 'Download ' + torrent.files[0].name
        document.body.appendChild(a)
      })
    })
    torrent.on('download',function (bytes) {
      console.log('torrent progress: ',torrent.progress,torrent.files[0].name)
    })
})

@bachlx-bitmark

This comment has been minimized.

Copy link
Author

@bachlx-bitmark bachlx-bitmark commented Apr 24, 2017

I found my problem, I have other process stop torrent when I try getBlod().
Thanks!

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 3, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.