БесконечноеЛето, const fs = require('fs'); const https = require('https'); const path = require('path'); function downloadImages(folderPath) { if (!fs.existsSync(folderPath)) { fs.mkdirSync(folderPath, { recursive: true }); } for (let index = 0; index < 647; index++) { downloadImage(folderPath, index); } } function downloadImage(folderPath, index) { const imageUrl = `https://example.com/i-${index}.jpg`; https.get(imageUrl, (response) => { let imageData = ''; response.on('data', (chunk) => { imageData += chunk; }); response.on('end', () => { const extension = path.extname(imageUrl) || '.jpg'; const imgName = `image_${index}${extension}`; const imgPath = path.join(folderPath, imgName); fs.writeFileSync(imgPath, imageData); console.log(`Downloaded ${imgName} successfully.`); }); }).on('error', (error) => { console.error(`Failed to download image: ${imageUrl}`, error); }); } const folderPath = "./downloaded_images"; downloadImages(folderPath); JS const fs = require('fs'); const https = require('https'); const path = require('path'); function downloadImages(folderPath) { if (!fs.existsSync(folderPath)) { fs.mkdirSync(folderPath, { recursive: true }); } for (let index = 0; index < 647; index++) { downloadImage(folderPath, index); } } function downloadImage(folderPath, index) { const imageUrl = `https://example.com/i-${index}.jpg`; https.get(imageUrl, (response) => { let imageData = ''; response.on('data', (chunk) => { imageData += chunk; }); response.on('end', () => { const extension = path.extname(imageUrl) || '.jpg'; const imgName = `image_${index}${extension}`; const imgPath = path.join(folderPath, imgName); fs.writeFileSync(imgPath, imageData); console.log(`Downloaded ${imgName} successfully.`); }); }).on('error', (error) => { console.error(`Failed to download image: ${imageUrl}`, error); }); } const folderPath = "./downloaded_images"; downloadImages(folderPath); Я написал уже, может пригодится когда нибудь