To convert octet-stream to any required data type.
I had a similar situation where i converted OCTET-STREAM into pdf.
Slight difference, might be helpful for others, I received json response and octet-stream Array was a field in that json response.
In this case, replace .pdf by .csv
octet_array is the array of octet values.
let arr = new Uint8Array(octet_array); let downloadLink = document.createElement('a'); let b = new Blob([arr], { type: 'application/octet-stream' }) downloadLink.href = window.URL.createObjectURL(b); downloadLink.setAttribute('download', "prescription.pdf"); document.body.appendChild(downloadLink); downloadLink.click(); downloadLink.parentNode.removeChild(downloadLink);