I am trying to read a excel file and create one locally. I have the below code
(async function () {
const fetchPromise = fetch(url);
let stream = await fetchPromise;
let reader = stream.body.getReader();
let decoder = new TextDecoder();
while(true) {
const {done, value} = await reader.read();
if (done){
break;
}
let res = decoder.decode(value, {stream: true, ignoreBOM: false});
console.log(res);
}
})();
I am seeing garbled characters when printing value of variable res
.
when i execute file -I
on the source file i am trying to read + create locally i see
count-3.xlsx: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=binary
What encoding scheme should i be passing to TextDecoder
so i do not see garbled characters?