Skip to content

Commit 24a86f4

Browse files
committed
clean up code
1 parent 9668b80 commit 24a86f4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

index.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const downloadFolder = (URL: string, currentPath: string = '') => {
4343
try {
4444
mkdirSync('out')
4545
} catch (e) {
46+
logger.info(`The directory out already exists`)
4647
}
4748

4849
// Download le files.
@@ -52,19 +53,19 @@ const downloadFolder = (URL: string, currentPath: string = '') => {
5253
if (data[i].type === 'directory') {
5354
try {
5455
// Create directory
55-
mkdirSync(`out/${currentPath}/${data[i].name}`)
56-
logger.info(`created out/${currentPath}/${data[i].name}`)
56+
mkdirSync(`out/${currentPath}${data[i].name}`)
57+
logger.info(`created out/${currentPath}${data[i].name}`)
5758
} catch (e) {
5859
// Error incase directory exists
59-
logger.error(`Directory out/${currentPath}/${data[i].name} exists already`)
60+
logger.error(`Directory out/${currentPath}${data[i].name} exists already`)
6061
}
6162
// Download the file
6263
downloadFolder(`${URL}${data[i].name}/`, currentPath + data[i].name + '/')
6364
logger.info(`Downloaded ${currentPath + data[i].name + '/'}`)
6465
} else {
6566
// Just download if in root directory
66-
Download(`${URL}${data[i].name}`).pipe(createWriteStream(`out/${currentPath + '/' + data[i].name}`))
67-
logger.info(`Downloaded ${data[i].name}`)
67+
Download(`${URL}${data[i].name}`).pipe(createWriteStream(`out/${currentPath + data[i].name}`))
68+
logger.info(`Downloaded out/${currentPath + data[i].name}`)
6869
}
6970
}
7071
})

0 commit comments

Comments
 (0)