Skip to content

Commit

Permalink
added support for lazy downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
da1nerd committed Jul 4, 2019
1 parent b1e8240 commit dff9e37
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bin/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ exports.builder = {
description: 'Overwrites the directory if it already exists',
default: false
},
lazy: {
description: 'Skips resources that have already been downloaded',
default: false
},
log: {
description: 'Log errors to log.txt',
default: false
Expand Down Expand Up @@ -138,6 +142,19 @@ exports.handler = function(argv) {
let list = [];
for(let group of resourceGroups) {
for(let resource of group) {
// skip downloaded files if lazy
if(argv.lazy) {
let fileName = `${resource.source_language_slug}_${resource.project_slug}_${resource.slug}`;
if(argv.close) {
fileName += '.tsrc';
}
let filePath = path.join(argv.dir, fileName);
if(fs.existsSync(filePath)) {
console.log('Skipping', fileName);
continue;
}
}

list.push({
languageSlug: resource.source_language_slug,
projectSlug: resource.project_slug,
Expand Down

0 comments on commit dff9e37

Please sign in to comment.