
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
h3-formidable
Advanced tools
File upload parsing utility for h3 and Nuxt using formidable.
Demo - https://stackblitz.com/edit/nuxt-starter-ykuwmn
npm install h3-formidable
This example shows Nuxt usage but you can use it with any h3 app.
import { createFileParserMiddleware } from 'h3-formidable'
export default createFileParserMiddleware({
// formidable options
})
export default eventHandler(async (event) => {
const { files } = event.context.formidable
})
or you can ditch server middleware and parse files per api route...
import { readFiles } from 'h3-formidable'
export default eventHandler(async (event) => {
const { fields, files, form } = await readFiles(event, {
// formidable options
// https://github.com/node-formidable/formidable#options
})
})
If you have a custom plugin, you can use the getForm option to access the incoming form and do whatever you want with it.
export default eventHandler(async (event) => {
const { fields, files } = await readFiles(event, {
getForm(form) {
form.use(() => {
console.log('woohoo, custom plugin')
})
}
})
})
Anything inside the getForm callback will be executed before the form is parsed.
import { firstValues, readBooleans } from 'h3-formidable/helpers'
export default eventHandler(async (event) => {
const { fields, files, form } = await readFiles(event)
// Gets first values of fields
const exceptions = ['thisshouldbeanarray']
const fieldsSingle = firstValues(form, fields, exceptions)
// Converts html form input type="checkbox" "on" to boolean
const expectedBooleans = ['checkbox1', 'wantsNewsLetter', 'hasACar']
const fieldsWithBooleans = readBooleans(fieldsSingle, expectedBooleans)
})
declare module 'h3' {
import type { FieldsAndFiles } from 'h3-formidable'
interface H3EventContext {
formidable: FieldsAndFiles
}
}
MIT
FAQs
File upload parsing utility for h3 and Nuxt.
The npm package h3-formidable receives a total of 816 weekly downloads. As such, h3-formidable popularity was classified as not popular.
We found that h3-formidable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.