import { type MultipartParserOptions, type MultipartPart } from '@remix-run/multipart-parser';
/**
* The base class for errors thrown by the form data parser.
*/
export declare class FormDataParseError extends Error {
constructor(message: string, options?: ErrorOptions);
}
/**
* An error thrown when the maximum number of files allowed in a request is exceeded.
*/
export declare class MaxFilesExceededError extends FormDataParseError {
constructor(maxFiles: number);
}
/**
* A file that was uploaded as part of a `multipart/form-data` request.
*/
export declare class FileUpload extends File {
/**
* The name of the `` field used to upload the file.
*/
readonly fieldName: string;
constructor(part: MultipartPart, fieldName: string);
}
/**
* A function used for handling file uploads.
*
* @param file The uploaded file
* @returns A value to store in `FormData`, or `void`/`null` to skip
*/
export interface FileUploadHandler {
/**
* Transforms an uploaded file into the value stored in the parsed {@link FormData}.
*/
(file: FileUpload): void | null | string | Blob | Promise;
}
/**
* Options for parsing form data.
*/
export interface ParseFormDataOptions extends MultipartParserOptions {
/**
* The maximum number of files that can be uploaded in a single request. If this limit is
* exceeded, a `MaxFilesExceededError` will be thrown.
*
* @default 20
*/
maxFiles?: number;
}
/**
* Parses a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) body into a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData)
* object. This is useful when accessing the data contained in a HTTP `multipart/form-data` request
* generated by a HTML `