As post says. Im expecting an object but i get an arraybuffer.
TypeScript
"use server"
export async function GetImageFromServer(imageID) {
const client = await createAdminClient()
const storage = new Storage(client);
const image = await storage.getFilePreview(process.env.NEXT_PUBLIC_BUCKET_ID,imageID);
console.log(image);
}
TL;DR
Developers are expecting an object but are receiving an ArrayBuffer instead when using GetFilePreview.
Solution: Convert the ArrayBuffer into an object using the appropriate method for the data structure being used.Output:
TypeScript
ArrayBuffer {
[Uint8Contents]: <89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 02 36 00 00 02 2a 08 06 00 00 00 37 a2 00 d5 00 00 80 00 49 44 41 54 78 da ec fd 57 b7 24 49 92 26 06 7e 6a 7e 79 70 ce 79 f2 ac e4 a4 78 17 eb 6e f4 60 28 06 33 3b 00 ce 59 e0 71 ff 46 ff 8e 7d da dd b3 3b 58 e0 f4 e0 2c 06 18 d2 53 5d 5d b4 ab ... 126554 more bytes>,
byteLength: 126654
}
Recommended threads
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- [Beginner] CLI --queries Syntax Error & ...
Hi everyone! I am a beginner with Appwrite and trying to use the CLI, but I'm stuck with a syntax error. Any guidance would be greatly appreciated! 🙏 **Enviro...
- [SOLVED] curl error Number: 6 — function...
Hello, I invested a lot of time in this error in a fresh install of appwrite 1.8.1 and lasted until fix, this if for helping anyone that can have the same weird...