Hi,
I’m using pipedream puppeteer’s option do go to a website, login with username and password and then click on this button:
When clicking this button in a regular browser an excel file is downloaded to my PC.
I want to use puppeteer to get the file and to return it and send it to a webhook - But I don’t really know how to do it.
I did something similar in the past with such a code:
// Convert the response body to a base64-encoded string
const buffer = await response.arrayBuffer();
const uint8Array = new Uint8Array(buffer);
const base64 = uint8Array.reduce(
(data, byte) => data + String.fromCharCode(byte),
‘’
);
return btoa(base64);
});
// Close the browser
await browser.close();
// Return the base64 representation of the PDF file
return result;
And then in another action in pipedream I used this code in order to return the data to a webhook that initiated the code:
So now I want to do something similar - but this time get the excel file that being download when clicking the button - I don’t think there is a need to convert it to base64 - but maybe I’m wrong and in order to rerun it to the webhook I have to do it?
at Object.run (file:///tmp/__pdg__/dist/code/b30680f56aec27a5a09baa331e356c88e8869380e4979e8dcd99f360f7bbb03a/component.mjs:26:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at null.executeComponent (/var/task/launch_worker.js:288:22)
at MessagePort.messageHandler (/var/task/launch_worker.js:788:28)