Handle files and multipart/form-data
Describe the feature
Should be great have a feature like multer on express and handle multipart/form-data on readBody() hook.
Additional information
- [ ] Would you be willing to help implement this feature?
This is supported by H3, so this should work already.
export default eventHandler(async event => {
const form = await readMultipartFormData(event)
// do stuff
})
Implemented here https://github.com/unjs/h3/blob/5f503c23286e431a249bf379b6bb779d62e71059/src/utils/body.ts#L111
Leaving this opens until this is documented.
@Hebilicious
Is it possible to limit what file types can be uploaded and what is the max file size? I see there is a type property but no file size.
Also I wonder if this counts as the documentation or is it still missing? https://www.jsdocs.io/package/h3#readMultipartFormData
https://h3.unjs.io/utils/request#readmultipartformdataevent