H
H
Hanry6542021-02-08 23:24:06
Node.js
Hanry654, 2021-02-08 23:24:06

How to send a request and wait for the "Download" event in nodejs?

There is a site that fills out forms using a get request, and then html2canvas turns it roughly into a photo and automatically downloads

html2canvas(document.querySelector("#capture")).then(canvas => {
    document.body.appendChild(canvas);
    let img = canvas.toDataURL("image/png");
    document.write('<img src="'+img+'"/> <p><a href="'+img+'" id="file" download>Скачать файл</a>');
    file.click()
});

But it all takes time, how can I send a request to this site and wait for the file to download, after which I actually download it?
Can you give an example in code?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question