UNPKG

@sigiljs/sigil

Version:

TypeScript-first Node.js HTTP framework offering schema-driven routing, modifier-based middleware, plugin extensibility, and flexible response templating

30 lines (29 loc) 1.22 kB
import { Internal } from '../../types'; /** * Options to configure multipart/form-data parsing limits and behavior. */ interface FormDataHandlerOptions { /** Maximum total size of all uploaded files in MiB. */ filesSizeLimit: number; /** Maximum size of a single uploaded file in MiB. */ singleFileSizeLimit: number; /** Maximum cumulative size of all fields in bytes. */ fieldsSizeLimit: number; /** Maximum number of non-file fields. */ fieldsLimit: number; /** Maximum number of files allowed. */ filesLimit: number; /** Whether to allow uploading empty files. */ allowEmptyFiles: boolean; } /** * Parses multipart/form-data requests into JSON fields and file buffers. * Uses formidable under the hood with in-memory buffering. * * @param req verified incoming HTTP message to parse. * @param options optional limits for files and fields. * @returns promise resolving to a RequestProcessorResponse * containing parsed fields and an array of IncomingFile instances. */ export default function formDataHandler(req: Internal.Requests.VerifiedIncomingMessage, options?: FormDataHandlerOptions): Promise<Internal.Requests.RequestProcessorResponse>; export {};