From 4df0457ab121ede74585b50a7f20e2340bcc015f Mon Sep 17 00:00:00 2001 From: Nadim Kobeissi Date: Tue, 24 Sep 2024 20:53:50 +0200 Subject: [PATCH] Cleanup --- mkbsd.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mkbsd.js b/mkbsd.js index b400476..d02593a 100644 --- a/mkbsd.js +++ b/mkbsd.js @@ -6,6 +6,9 @@ const path = require(`path`); async function main() { const url = 'https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s'; + const delay = (ms) => { + return new Promise(resolve => setTimeout(resolve, ms)); + } try { const response = await fetch(url); if (!response.ok) { @@ -22,9 +25,6 @@ async function main() { console.info(`📁 Created directory: ${downloadDir}`); } let fileIndex = 1; - function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } for (const key in data) { const subproperty = data[key]; if (subproperty && subproperty.dhd) { @@ -52,7 +52,6 @@ async function downloadImage(url, filePath) { } const arrayBuffer = await response.arrayBuffer(); const buffer = Buffer.from(arrayBuffer); - await fs.promises.writeFile(filePath, buffer); }