From ed2aa1f17b57b47c426a9743d17c5cee2739a74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B5=D0=BE=D1=80=D0=B3=D0=B8=D0=B9=20=D0=91=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Sat, 5 Mar 2022 20:24:28 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6?= =?UTF-8?q?=D0=B0=20jam=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- download_figma_files.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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.`)