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

How to get the total content size of a .torrent file or a magnet link? #1317

Closed
Shai1436 opened this issue Feb 25, 2018 · 1 comment
Closed

How to get the total content size of a .torrent file or a magnet link? #1317

Shai1436 opened this issue Feb 25, 2018 · 1 comment

Comments

@Shai1436
Copy link

@Shai1436 Shai1436 commented Feb 25, 2018

How to get the total content size of a .torrent file or a magnet link without adding it to a client?
We can add the link to the client, get the total size and remove it from the client. (But it won't delete the file in the temporary folder).
Isn't there a better way to do this? Thanks!

@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Feb 25, 2018

Hey @Shai1436,

Your best choice would be to parse the torrent with parse-torrent and then use the .length property though this would only work for a .torrent file.

Since magnetURI don't contain the metadata, you would have to first find the metadata from a peer before you would know the length, you could use torrent-discovery. though if you use client.add from webtorrent and save the metadata on the metadata event and then destroy the torrent before the ready event, no store should be created. (after looking through, when metadata fires the store is created, ready is only fired once the store is fully created)

Hope this helps!

@feross feross closed this Apr 21, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 20, 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
3 participants
You can’t perform that action at this time.