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 upPersisting torrent download state #456
Closed
Labels
Comments
This comment has been minimized.
This comment has been minimized.
|
Alright, I have done some testing and apparently the torrent starts from where it left off. Also, the event I was looking for is called 'done' in the torrent object itself. Code example: client.download(magnetUri, {path: process.cwd() + '/data'}, function (torrent) {
// Got torrent metadata!
console.log('Torrent info hash:', torrent.infoHash)
console.log('Save location: ' + torrent.path);
// this is called every time we receive a chunk
torrent.on('download', function(chunkSize){
console.log('chunk size: ' + chunkSize);
console.log('total downloaded: ' + torrent.downloaded);
console.log('download speed: ' + torrent.downloadSpeed());
console.log('progress: ' + torrent.progress);
console.log('======');
})
torrent.on('done', function(){
console.log('torrent downloaded!');
torrent.files.forEach(function(file){
// do something with file
})
})
}) |
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.
Hey guys, nice job!
I have a question, if I start downloading a file like this:
And the download reaches 50%, but for some reason my server crashes, if I restart the server, and add the same torrent again with the same destination path, will it continue downloading from where it stopped?
Also, there's any event in client that notifies when a torrent was completed?