1 |
|
2 | import { MultipartFile } from './file.js';
|
3 | import type { MultipartStream, FileValidationOptions } from '../types.js';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export declare class PartHandler {
|
16 | #private;
|
17 | |
18 |
|
19 |
|
20 |
|
21 | file: MultipartFile;
|
22 | constructor(part: MultipartStream, options: Partial<FileValidationOptions & {
|
23 | deferValidations: boolean;
|
24 | }>);
|
25 | /**
|
26 | * Start the process the updating the file state
|
27 | * to streaming mode.
|
28 | */
|
29 | begin(): void;
|
30 | /**
|
31 | * Handles the file upload progress by validating the file size and
|
32 | * extension.
|
33 | */
|
34 | reportProgress(line: Buffer, bufferLength: number): Promise<void>;
|
35 | /**
|
36 | * Report errors encountered while processing the stream. These can be errors
|
37 | * apart from the one reported by this class. For example: The `s3` failure
|
38 | * due to some bad credentails.
|
39 | */
|
40 | reportError(error: any): Promise<void>;
|
41 | /**
|
42 | * Report success data about the file.
|
43 | */
|
44 | reportSuccess(data?: {
|
45 | filePath?: string;
|
46 | tmpPath?: string;
|
47 | } & {
|
48 | [key: string]: any;
|
49 | }): Promise<void>;
|
50 | }
|