This example triggers a native download by posting a file to the backend `/download-document` endpoint. Use the form file input to pick a .docx and click "Remediate & Download".
Windows may add the Mark-of-the-Web (Zone.Identifier) to downloaded files. To remove it locally:
PowerShell: Unblock-File -Path 'C:\path\to\your\downloaded.docx'
To check for alternate data streams (Zone.Identifier):
PowerShell: Get-Item -Path 'C:\path\to\your\downloaded.docx' -Stream *
If you prefer fetching the file with JS and saving a blob (note: native downloads via form submit often behave better for Content-Disposition handling and browser integration):
// Example (browser):
// const data = new FormData();
// data.append('file', fileInput.files[0]);
// fetch('/api/download-document', { method: 'POST', body: data })
// .then(r => {
// const filename = r.headers.get('content-disposition')?.split('filename=')?.[1]?.replace(/\"/g, '') || 'remediated.docx';
// return r.blob().then(b => ({ b, filename }));
// })
// .then(({ b, filename }) => {
// const url = URL.createObjectURL(b);
// const a = document.createElement('a');
// a.href = url; a.download = filename; document.body.appendChild(a); a.click(); a.remove();
// })