AlexOriginal post
Rank 1: Thread
Trying to create and send a file to the storage files but receiving an error
JavaScript
import * as sdk from 'node-appwrite';export const actions = { default: async ( {request} ) => { const formData = await request.formData(); const data = formData.get('dataModel'); const blob = new Blob([data], { type: file.type}); const promise = storage.createFile( BUCKET_ID, sdk.ID.unique(), sdk.InputFile.fromBlob(blob, file.name) ); }}Error:
Bash
TypeError: Cannot read properties of undefined (reading 'pipe')Summary
Developers are encountering errors when attempting to use the appwrite SDKs storage methods inside a Sveltekit server-side function. The issue seems to stem from the 'request' object not including the necessary methods for file handling. To resolve this problem, developers can try passing along the file directly to the storage createFile method, rather than using formData.