Web Developer
I need help to upload file (Image) through Cloud Function. Now i receive an error message, ""error": "Cannot read properties of undefined (reading 'Symbol(Symbol.asyncIterator)')" with base64 technique.
my code is:
// Decode the base64-encoded image
const base64Data = profilePicture.replace(/^data:image/\w+;base64,/, "");
const buffer = Buffer.from(base64Data, 'base64');
// Save the decoded image as a file
const filePath = path.join('/tmp', ${ID.unique()}.png);
fs.writeFileSync(filePath, buffer);
const fileStream = fs.createReadStream(filePath);
//Save file to storage
const uploadedFile = await storage.createFile(teacherImageBucketId, ID.unique(), fileStream);