Socket
Socket
Sign inDemoInstall

h3-formidable

Package Overview
Dependencies
7
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    h3-formidable

File upload parsing utility for h3 and Nuxt.


Version published
Weekly downloads
902
increased by21.24%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

h3-formidable

npm (tag) NPM

File upload parsing utility for h3 and Nuxt using formidable.

Install

npm install h3-formidable

Usage

per route

import { readFiles } from 'h3-formidable'

export default eventHandler(async (event) => {
  // only files
  const files = await readFiles(event)

  // with fields
  const { fields, files } = await readFiles(event, {
    includeFields: true,
    // other formidable options here
  })
})

middleware

import { createFileParserMiddleware } from 'h3-formidable'

const app = createApp()

app
  .use(createFileParserMiddleware({}))
  .use(eventHandler((event) => {
    // event.context.files
  }))
declare module 'h3' {
  import type { Files } from 'h3-formidable'

  interface H3EventContext {
    files: Files
  }
}

License

MIT

Keywords

FAQs

Last updated on 03 Dec 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc