mirror of
https://github.com/nadimkobeissi/mkbsd.git
synced 2024-12-22 02:35:34 +00:00
Cleanup
This commit is contained in:
parent
8652de12e3
commit
4df0457ab1
7
mkbsd.js
7
mkbsd.js
|
@ -6,6 +6,9 @@ const path = require(`path`);
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const url = 'https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s';
|
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 {
|
try {
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
@ -22,9 +25,6 @@ async function main() {
|
||||||
console.info(`📁 Created directory: ${downloadDir}`);
|
console.info(`📁 Created directory: ${downloadDir}`);
|
||||||
}
|
}
|
||||||
let fileIndex = 1;
|
let fileIndex = 1;
|
||||||
function delay(ms) {
|
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
|
||||||
}
|
|
||||||
for (const key in data) {
|
for (const key in data) {
|
||||||
const subproperty = data[key];
|
const subproperty = data[key];
|
||||||
if (subproperty && subproperty.dhd) {
|
if (subproperty && subproperty.dhd) {
|
||||||
|
@ -52,7 +52,6 @@ async function downloadImage(url, filePath) {
|
||||||
}
|
}
|
||||||
const arrayBuffer = await response.arrayBuffer();
|
const arrayBuffer = await response.arrayBuffer();
|
||||||
const buffer = Buffer.from(arrayBuffer);
|
const buffer = Buffer.from(arrayBuffer);
|
||||||
|
|
||||||
await fs.promises.writeFile(filePath, buffer);
|
await fs.promises.writeFile(filePath, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue