Socket
Socket
Sign inDemoInstall

h3-formidable

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

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
1.3K
increased by27.79%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 17 Apr 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc