File arriving in larger than expected size in multipart/form-data
We have migrated a large express app to hono + @hono/zod-openapi and everything is great except our multipart/form-data file uploads.
The route looks like this:
The file is correctly available with all the details and content but they problem is that the content appears to be corrupt in some way since the size of the file uploaded is 1.2mb and the
file.size
in the route handler comes to around 2mb. When I save the file (an image) in S3 and retrieve it it's not consider an image.
Note that all the code for saving/retrieving file was working in the express app and is 100% the same. What could be the cause here?
Only difference is that in the express app we used multer
to parse the request body where as in hono I'm not using anything.5 Replies
Is there any specific behaviour around multipart/form-data that I'm not aware of? Any tips would be appreciated.
Thanks!
are you sending the file w the right encoding/mime type?
Yes it's the correct mime type, I also thought something might be base64 encoding it but it's not that either.
rip
you could use the S3 sdk directly
You mean presigned url upload? Yea we do that but this is an old area that doesn't see much action.