1 | import type { HttpContext } from '@adonisjs/http-server';
|
2 | import type { FileValidationOptions, PartHandler as PartHandlerType } from '../types.js';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export declare class Multipart {
|
9 | #private;
|
10 | |
11 |
|
12 |
|
13 | state: 'idle' | 'processing' | 'error' | 'success';
|
14 | constructor(ctx: HttpContext, config?: Partial<{
|
15 | limit: string | number;
|
16 | fieldsLimit: string | number;
|
17 | maxFields: number;
|
18 | convertEmptyStringsToNull: boolean;
|
19 | }>);
|
20 | /**
|
21 | * Attach handler for a given file. To handle all files, you
|
22 | * can attach a wildcard handler.
|
23 | *
|
24 | * @example
|
25 | * ```ts
|
26 | * multipart.onFile('package', {}, async (stream) => {
|
27 | * })
|
28 | *
|
29 | * multipart.onFile('*', {}, async (stream) => {
|
30 | * })
|
31 | * ```
|
32 | */
|
33 | onFile(name: string, options: Partial<FileValidationOptions & {
|
34 | deferValidations: boolean;
|
35 | }>, handler: PartHandlerType): this;
|
36 | /**
|
37 | * Abort request by emitting error
|
38 | */
|
39 | abort(error: any): void;
|
40 | /**
|
41 | * Process the request by going all the file and field
|
42 | * streams.
|
43 | */
|
44 | process(config?: Partial<{
|
45 | limit: string | number;
|
46 | maxFields: number;
|
47 | }>): Promise<void>;
|
48 | }
|