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 upGet InfoHash before downloading torrent #816
Closed
Labels
Comments
This comment has been minimized.
This comment has been minimized.
|
You can listen to the var torrent = client.add(torrentId)
torrent.on('infoHash', function (infoHash) {
// ...
})Another way to customize the storage location based on the infoHash is to use the function Store (chunkLength, opts) {
console.log(opts.torrent.infoHash)
}
client.add(torrentId, {
store: Store
})Or, probably the simplest way is to use var parseTorrent = require('parse-torrent')
var parsed = parseTorrent(torrentId)
console.log(parsed.infoHash)
client.add(torrentId, ...) |
This comment has been minimized.
This comment has been minimized.
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Unless I'm mistaken there doesn't appear to be any way to get the InfoHash of a .Torrent file or Magnet link before downloading the torrent.
I think this would be useful for building WebTorrent applications that sport offline storage.
Example: I'm building something that downloads the files and stores them offline in an array using LocalForage and sets the InfoHash as the key of that storage so when a user opens a link to that same torrent it'll just search to see if it's stored offline already and use the offline stored copies instead.