import { Buffer } from 'node:buffer'; import type { ServerResponse as Response } from 'node:http'; import type { LimitErrorFn, NextFunction, ParserOptions, ReqWithBody } from './types.ts'; export * from './types.ts'; export declare const p: (fn: (body: Buffer, req: ReqWithBody) => void, payloadLimit?: number, payloadLimitErrorFn?: LimitErrorFn) => (req: ReqWithBody, _res: Response, next?: (err?: any) => void) => Promise; /** * Parse payload with a custom function * @param fn */ declare const custom: (fn: (body: Buffer) => any, type?: ParserOptions["type"]) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise; /** * Parse JSON payload * @param options */ declare const json: ({ payloadLimit, payloadLimitErrorFn, type, reviver }?: ParserOptions<{ reviver?: (this: any, key: string, value: any) => any; }>) => (req: ReqWithBody, res: Response, next?: NextFunction) => Promise; /** * Parse raw payload * @param options */ declare const raw: ({ payloadLimit, payloadLimitErrorFn, type }?: ParserOptions) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise; /** * Stringify request payload * @param param0 * @returns */ declare const text: ({ payloadLimit, payloadLimitErrorFn, type }?: ParserOptions) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise; /** * Parse urlencoded payload * @param options */ declare const urlencoded: ({ payloadLimit, payloadLimitErrorFn, type }?: ParserOptions) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise; type MultipartOptions = Partial<{ /** * Limit number of files */ fileCountLimit: number; /** * Limit file size (in bytes) */ fileSizeLimit: number; /** * Custom error function for file size limit */ fileSizeLimitErrorFn: LimitErrorFn; }>; /** * Parse multipart form data (supports files as well) * * Does not restrict total payload size by default. * @param options */ declare const multipart: ({ payloadLimit, payloadLimitErrorFn, type, ...opts }?: MultipartOptions & ParserOptions) => (req: ReqWithBody, res: Response, next?: NextFunction) => Promise; export { custom, json, raw, text, urlencoded, multipart };