Been following the buildspace AI avatar generator project and loving it so far!
I did come across an issue when creating the React app. In the bufferToBase64 function:
const bufferToBase64 = (buffer) => {
let arr = new Uint8Array(buffer);
const base64 = btoa(
arr.reduce((data, byte) => data + String.fromCharCode(byte), '')
)
return `data:image/png;base64,${base64}`;
};
I had an issue with btoa not being defined:
error - ReferenceError: btoa is not defined
I did an npm install --save buffer and added import { btoa } from "buffer"; to pages/api/generate.js which fixed my issue. Not sure if anyone else had the same issue?
Been following the buildspace AI avatar generator project and loving it so far!
I did come across an issue when creating the React app. In the
bufferToBase64function:I had an issue with
btoanot being defined:I did an
npm install --save bufferand addedimport { btoa } from "buffer";topages/api/generate.jswhich fixed my issue. Not sure if anyone else had the same issue?