
I've been stuck on this for way too long.
I should be downloading the file as a stream and writing to a storage bucked with that stream, but I keep getting an error. Am I creating the file correctly?
TypeScript
// Download the image directly as a stream
const imageResponse = await axios.get(output, { responseType: "arraybuffer", timeout: 10000}); // Use arraybuffer for compatibility
// Convert the array buffer to a Buffer
const imageBuffer = Buffer.from(imageResponse.data);
// Upload the image to Appwrite storage directly
const createFile = await storage.createFile(
config.bucketId, // Replace with your Appwrite storage bucket ID
ID.unique(), // Generate a unique file ID
imageBuffer, // Pass the stream directly
["user:" + account_id] // Set user-specific permissions (read/write access)
);
TL;DR
The developer is attempting to download an image file as a stream and write it to a storage bucket using Axios and Appwrite. They are converting the array buffer to a Buffer and uploading it to the storage directly. The issue may be related to how the file is being created in the bucket. Recommended threads
- Collection Permission issue
I am facing issue in my Pro account. "Add" button is disabled while adding permission in DB collection settings.
- Having Some Trouble With Getting Started
Hi everyone. I'm having some issues with the initial setup of AppWrite for my React Native mobile app. I've done step 1 and 2, but when it comes to step 3, I op...
- SSO google apple not working anymore
We use Apple and Google sso in our react native app. Everything worked fine until we noticed today that we see general argument error. We did not change anythi...
