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: <T = any>(fn: (body: Buffer, req: ReqWithBody<T>) => void, payloadLimit?: number, payloadLimitErrorFn?: LimitErrorFn) => (req: ReqWithBody<T>, _res: Response, next?: (err?: any) => void) => Promise<T | undefined>;
/**
 * Parse payload with a custom function
 * @param fn
 */
declare const custom: <T = any>(fn: (body: Buffer) => any, type?: ParserOptions["type"]) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise<void>;
/**
 * 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<void>;
/**
 * Parse raw payload
 * @param options
 */
declare const raw: ({ payloadLimit, payloadLimitErrorFn, type }?: ParserOptions) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise<void>;
/**
 * Stringify request payload
 * @param param0
 * @returns
 */
declare const text: ({ payloadLimit, payloadLimitErrorFn, type }?: ParserOptions) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise<void>;
/**
 * Parse urlencoded payload
 * @param options
 */
declare const urlencoded: ({ payloadLimit, payloadLimitErrorFn, type }?: ParserOptions) => (req: ReqWithBody, _res: Response, next?: NextFunction) => Promise<void>;
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<void>;
export { custom, json, raw, text, urlencoded, multipart };
