/** * Minimal `multipart/form-data` parser (RFC 7578 / RFC 2046). * * Handles the subset needed by the import-file upload endpoint: * - A single file part with `Content-Disposition: form-data; name="file"; filename="..."` * and an optional `Content-Type` header. The part body is captured as raw bytes. * - Zero or more text parts with `Content-Disposition: form-data; name="..."` and a * utf-8 string body. * * Deliberate non-features (out of scope for V10.0): * - Nested multipart bodies (`multipart/mixed` inside a part) * - `Content-Transfer-Encoding: base64` / `quoted-printable` (browsers don't send these) * - Streaming — we parse a fully-buffered `Buffer`, which is the shape daemon.ts * already has from `readBody` * - Charset negotiation on text parts — everything non-file is treated as utf-8 * * Throws `MultipartParseError` on malformed input so the route handler can * return a clean 400 to the caller. */ export declare class MultipartParseError extends Error { constructor(message: string); } export interface MultipartField { /** `name` attribute from the `Content-Disposition` header. */ name: string; /** `filename` attribute, if the part is a file upload. Undefined for text parts. */ filename?: string; /** `Content-Type` header of the part, or undefined if not provided. */ contentType?: string; /** Raw part body as bytes. For text parts, caller can decode via `.toString('utf-8')`. */ content: Buffer; } /** * Extract the boundary token from a `Content-Type: multipart/form-data; boundary=...` header. * Returns null if the header is missing, malformed, ambiguous, or not multipart/form-data. * * Accepts the full `IncomingHttpHeaders['content-type']` shape (`string | string[] | undefined`) * so that callers can pass `req.headers['content-type']` directly. Array values — which Node * can deliver when a client sends duplicated Content-Type headers — are rejected as ambiguous * rather than coerced, so the route handler returns a clean 400 instead of crashing inside * `.toLowerCase()`. */ export declare function parseBoundary(contentTypeHeader: string | string[] | undefined): string | null; /** * Parse a fully-buffered `multipart/form-data` body into its constituent fields. * `boundary` is the boundary token (without the leading `--`). */ export declare function parseMultipart(body: Buffer, boundary: string): MultipartField[]; //# sourceMappingURL=multipart.d.ts.map