БесконечноеЛето, const fs = require("fs"); const https = require("https"); const path = require("path"); function downloadImages(folderPath) { if (!fs.existsSync(folderPath)) { fs.mkdirSync(folderPath, { recursive: true }); } const from = 637; const to = 647; for (let index = from; index < to; index++) { downloadImage(folderPath, index); } } function downloadImage(folderPath, index) { const imageUrl = `https://example.com/i-${index}.jpg`; https .get(imageUrl, (response) => { const chunks = []; response.on("data", (chunk) => { chunks.push(chunk); }); response.on("end", () => { const imageData = Buffer.concat(chunks); 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 }); } const from = 637; const to = 647; for (let index = from; index < to; index++) { downloadImage(folderPath, index); } } function downloadImage(folderPath, index) { const imageUrl = `https://example.com/i-${index}.jpg`; https .get(imageUrl, (response) => { const chunks = []; response.on("data", (chunk) => { chunks.push(chunk); }); response.on("end", () => { const imageData = Buffer.concat(chunks); 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); Этот точно рабочий, по той ссылке что ты давал скачивает картинки