import fs from "fs"; /** * Downloads a script from a URL. * @param url The URL to download the script from. * @param fileName The name of the file to download the script to. */ async function downloadScript(url: string, fileName: string): Promise { if (url === "" || fileName === "") { console.error("URL or fileName is empty"); return; } const response = await fetch(url); const currentDir = process.cwd(); if (response.ok) { const blob = await response.blob(); fs.writeFileSync(currentDir + "/" + fileName, await blob.text(), {}); } } export { downloadScript };