UNPKG

ufiber

Version:

Next-gen webserver for node-js developer

49 lines (48 loc) 1.44 kB
//#region src/utils/body.d.ts type FormOption = { /** Allowed file fields (omit to allow any). */ fileFields?: string | string[]; /** Max single file size in bytes (default: 5 MB). */ fileSize?: number; /** Max number of files (default: 5). */ files?: number; }; /** * Simple FormData-like container for Node. * Supports multiple values per key and JSON conversion. */ declare class FormData extends Map<string, any> { /** * Appends a new value for the given key. * If the key already exists, converts the value into an array * and pushes the new value into it. * * @param name - The key name. * @param value - The value to append. */ append(key: string, value: any): void; /** * Returns the first value associated with the given key. * If multiple values exist, only the first one is returned. * * @param name - The key to look up. * @returns The first value, or `undefined` if not found. */ get<T>(name: string): T; /** * Returns all values associated with the given key. * Always returns an array (empty if key not found). * * @param name - The key to look up. * @returns An array of values. */ getAll<T>(key: string): T[]; /** * Converts the entire form to a plain JavaScript object. * * @returns A `Record<string, any>` containing all keys and values. */ toJSON(): Record<string, any>; } //#endregion export { FormData, FormOption };