Closed plattegruber closed 8 months ago
Hey @plattegruber, thanks for the feedback.
Currently, upload-client doesn't support native Node's FormData
and File
instances as an input source. You need to convert them to the Buffer
before:
let file = formData.get("file");
let arrayBuffer = await file.arrayBuffer();
let buffer = Buffer.from(arrayBuffer);
Hey @plattegruber, thanks for the feedback.
Currently, upload-client doesn't support native Node's
FormData
andFile
instances as an input source. You need to convert them to theBuffer
before:let file = formData.get("file"); let arrayBuffer = await file.arrayBuffer(); let buffer = Buffer.from(arrayBuffer);
Thanks @nd0ut! That makes sense, I appreciate the help.
Describe the bug
👋🏽 I'm running into a reproducible issue. Hopefully this is just me missing something simple.
I'm seeing an exception
TypeError: source.on is not a function
when trying to save an image in a Sveltekit project. Full trace:+page.svelte
file:+page.server.js
file:export const actions = { default: async({request}) => { let formData = await request.formData(); let file = formData.get('file'); await uploadFile(file, { publicKey: UPLOADCARE_API_KEY, }); } }