0

so I am using Puppeteer to go to a website and grab a href direct download link, which everything works well, I would like to know if there is any way I can download the file in NodeJs instead of downloading it in the browser? so I don't want the browser opens, I'd like to use (fs) to push the downloaded file wherever I want. Thank you


(async()=>{

    const browser = await puppeteer.launch({
        headless: false,
        defaultViewport: false
    });

    const page = await browser.newPage();
    const url = `https://speed.hetzner.de/`;
    await page.goto(url, {"waitUntil": "networkidle2"});
    // await page.waitForTimeout('2000');
    const download = await page.$eval('p:nth-child(2) > a', elm => elm.href);
    console.log(download);
})();```
New coder
  • 59
  • 4
  • 2
    Does this answer your question? [How to download file with direct link Puppeteer?](https://stackoverflow.com/questions/66527429/how-to-download-file-with-direct-link-puppeteer) – ggorlen Jul 13 '22 at 15:33

0 Answers0