diff --git a/download_figma_files.js b/download_figma_files.js index 1477ca9..3002e10 100755 --- a/download_figma_files.js +++ b/download_figma_files.js @@ -248,6 +248,12 @@ const puppeteer = require('puppeteer'); fse.moveSync(downloadDir + fileName+'.fig', downloadDir + fileName + '_' + now + '.fig') } + if (fs.existsSync(downloadDir + fileName+'.jam')) { + const now = new Date().toISOString().substring(0, 19).replaceAll('T', '_').replaceAll(':','-'); + fse.moveSync(downloadDir + fileName+'.jam', downloadDir + fileName + '_' + now + '.jam') + } + + console.log("Directory to save the file: '" + downloadDir + "'"); fs.mkdirSync(downloadDir, {recursive: true}); @@ -324,6 +330,11 @@ const puppeteer = require('puppeteer'); console.log('Download complete'); break; } + + if (fs.existsSync(downloadDir + fileName+'.jam')) { + console.log('Download complete'); + break; + } if (j % 30 == 0) { console.log(`waiting files to download for ${parseInt(j / 60)} min ${j % 60} sec.`)