I've written a NodeJS/Express application that generates and downloads an excel document (created using ExcelJS) upon the user pressing a button. When the user presses the button, the file is generated then downloaded to the user's default download location. I'd prefer the user be able to select where they'd like to download the file upon pressing the button. Is this possible?
My current JavaScript code is as follows:
export_button.onclick = async function() {
await fetch('/download', {
method: 'POST'
})
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = 'document.xlsx';
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
});
}