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

Add local file deletion on `torrent.destroy` #1102

Open
wants to merge 4 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Add check on `fs.stat` for browser compatibility

  • Loading branch information
Rowern committed Apr 15, 2017
commit efdeae7eb2c5d83b411077242abe535b59b1db2a
@@ -45,13 +45,18 @@ test('torrent.destroy: seed torrent and remove it', function (t) {

client.remove(torrent, {'remove': true}, function (err) {
t.error(err, 'torrent removed')
fs.stat(completeFileName, function (err) {
if (err && err.code === 'ENOENT') return t.pass('File deleted')
t.fail('File not deleted')
})
// Check if stat is available
if (fs.stat) {
fs.stat(completeFileName, function (err) {
if (err && err.code === 'ENOENT') return t.pass('File deleted')
t.fail('File not deleted')
})
} else {
t.pass('File deleted')
}
t.equal(client.torrents.length, 0)

client.destroy(function (err) { t.error(err, 'client destroyed') })
})
t.equal(client.torrents.length, 0)

client.destroy(function (err) { t.error(err, 'client destroyed') })
})
})
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.