Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCreating a download link to a file within the .torrent #1366
Comments
This comment has been minimized.
This comment has been minimized.
|
I've now replaced the hardcoded index check for the forEach just incase I might be missing the file, still not able to get the getBlobURL() to run.
|
This comment has been minimized.
This comment has been minimized.
|
Here is a live code snippet showing that the download links are never rendered because getBlobURL does not work. |
This comment has been minimized.
This comment has been minimized.
|
OK more info on this issue. I left the download demo running in my tab in Chrome, and roughly 10 mins later the getBlobURL() fires off and was able to render my download link which did work. I also opened the seeding tab and my download demo tab on FF, about 10 mins later the getBlobURL fired off and worked..... Chrome also gave this error: 29webtorrent.js:7 Uncaught DOMException: Failed to construct 'RTCPeerConnection': Cannot create so many PeerConnections |
This comment has been minimized.
This comment has been minimized.
The
From what I see in your code snippet you are using an old version of Webtorrent (0.27.3). Try using the latest one (0.99.3): https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js |
This comment has been minimized.
This comment has been minimized.
|
I'll get latest. What's a way to generate a download link will waiting for the full file to be downloaded? |
This comment has been minimized.
This comment has been minimized.
|
@Nashorn You can show a download link on your site however you want to. This is not really a WebTorrent concern. WebTorrent can't generate the Blob URL until the data is fully downloaded. This is just how Blobs work in the browser. You need all the data available at the time you create the Blob. So, I would show some UI that let's the user know the file is still downloading before you show the link. Or, you can show a link and let them click it, and then show the download progress until the callback is called. You can check the progress by checking |
I've been trying a simple demo to show a download link, but the getBlobUrl() seems to never run, can't get my debugger; to hit.
Example posted by another user:
https://gist.github.com/DiegoRBaquero/4235c7283e7ff579cdd093305803e799
This is what I am trying: