修改下载 pandoc 脚本,文件存在就不下载

This commit is contained in:
purocean
2019-08-09 18:12:19 +08:00
parent 9625bc81f0
commit 27bc91a96b
+6 -3
View File
@@ -12,6 +12,9 @@ if (!fs.existsSync(dir)) {
}
const filePath = path.join(dir, filename)
console.log('Download pandoc', downloadUrl, filename, filePath)
request(downloadUrl).pipe(fs.createWriteStream(filePath))
if (fs.existsSync(filePath)) {
console.warn('Pandoc exists. Skip download.', filePath)
} else {
console.info('Download pandoc', downloadUrl, filename, filePath)
request(downloadUrl).pipe(fs.createWriteStream(filePath))
}