@adonisjs/bodyparser
Version:
BodyParser middleware for AdonisJS http server to read and parse request body
42 lines (41 loc) • 1.24 kB
TypeScript
import { MultipartFile } from '../src/multipart/file.ts';
import { type FileValidationOptions } from '../src/types.ts';
/**
* Parameters for configuring the file factory
*/
type FileFactoryParameters = {
/** The form field name */
fieldName: string;
/** The original filename from the client */
clientName: string;
/** Headers associated with the file */
headers: any;
/** Size of the file in bytes */
size: number;
/** File extension */
extname: string;
/** MIME type of the file */
type: string;
/** MIME subtype */
subtype: string;
};
/**
* File factory exposes the API to create fake multipart file instances
* for testing purposes
*/
export declare class MultipartFileFactory {
#private;
/**
* Merge additional factory parameters with existing ones
*
* @param params - Parameters to merge with existing factory parameters
*/
merge(params: Partial<FileFactoryParameters>): this;
/**
* Create an instance of multipart file with the configured parameters
*
* @param validationOptions - Optional validation options for the file
*/
create(validationOptions?: Partial<FileValidationOptions>): MultipartFile;
}
export {};