Skip to content

Commit

Permalink
Prevent progress bar from starting if file already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagofilipe12 committed Apr 19, 2017
1 parent 4d01945 commit 3cfa511
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/bionode-ncbi.js
Expand Up @@ -400,10 +400,16 @@ function download (db) {
debug('downloading', url)
var options
if (opts.pretty === true) {
options = { dir: folder, resume: true, quiet: false }
if (fs.existsSync(path)) {
console.log('File already exists in: ' + path + '\n')
options = { dir: folder, resume: true, quiet: true }
} else {
options = { dir: folder, resume: true, quiet: false }
}
} else {
options = { dir: folder, resume: true, quiet: true }
}

var dld = nugget(PROXY + url, options, function (err) {
if (err) return self.destroy(err)
fs.stat(path, gotStat)
Expand Down

0 comments on commit 3cfa511

Please sign in to comment.