1

While I'm trying to convert byte-array image data into Base64 string it throws "Maximum call stack size exceeded" error.

I'm assuming that , if byte-array length is over 100000 then this error is showing because other api data are working fine.

Here you can check code block where i'm having issue.

Thanks in Advance

const response = await fetch(`API URL`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${authToken}`,
    Accept: "*/*",
  },
});
if (!response.ok) {
  throw new Error("Network response was not ok");
}
const buffer = await response.arrayBuffer();
const base64String = Base64.btoa(
  String.fromCharCode(...new Uint8Array(buffer)),
);
setDataURL("data:image/png;base64," + base64String);

I did try multiple way...

2

0

Browse other questions tagged or ask your own question.