1 |
|
2 | import { DisksList, WriteOptions, DriveManagerContract } from '@ioc:Adonis/Core/Drive';
|
3 | import { FileUploadError, FileValidationOptions, MultipartFileContract } from '@ioc:Adonis/Core/BodyParser';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export declare class File implements MultipartFileContract {
|
9 | private data;
|
10 | private drive;
|
11 | private sizeValidator;
|
12 | private extensionValidator;
|
13 | |
14 |
|
15 |
|
16 |
|
17 | isMultipartFile: true;
|
18 | |
19 |
|
20 |
|
21 | fieldName: string;
|
22 | |
23 |
|
24 |
|
25 | clientName: string;
|
26 | |
27 |
|
28 |
|
29 | headers: any;
|
30 | |
31 |
|
32 |
|
33 | size: number;
|
34 | |
35 |
|
36 |
|
37 | extname?: string;
|
38 | |
39 |
|
40 |
|
41 | errors: FileUploadError[];
|
42 | |
43 |
|
44 |
|
45 |
|
46 | type?: string;
|
47 | subtype?: string;
|
48 | |
49 |
|
50 |
|
51 | filePath?: string;
|
52 | |
53 |
|
54 |
|
55 |
|
56 | fileName?: string;
|
57 | |
58 |
|
59 |
|
60 |
|
61 | tmpPath?: string;
|
62 | |
63 |
|
64 |
|
65 | meta: any;
|
66 | |
67 |
|
68 |
|
69 | state: 'idle' | 'streaming' | 'consumed' | 'moved';
|
70 | |
71 |
|
72 |
|
73 | get validated(): boolean;
|
74 | |
75 |
|
76 |
|
77 | get isValid(): boolean;
|
78 | |
79 |
|
80 |
|
81 | get hasErrors(): boolean;
|
82 | |
83 |
|
84 |
|
85 | get sizeLimit(): number | string | undefined;
|
86 | set sizeLimit(limit: number | string | undefined);
|
87 | |
88 |
|
89 |
|
90 | get allowedExtensions(): string[] | undefined;
|
91 | set allowedExtensions(extensions: string[] | undefined);
|
92 | constructor(data: {
|
93 | fieldName: string;
|
94 | clientName: string;
|
95 | headers: any;
|
96 | }, validationOptions: Partial<FileValidationOptions>, drive: DriveManagerContract);
|
97 | /**
|
98 | * Validate the file
|
99 | */
|
100 | validate(): void;
|
101 | /**
|
102 | * Mark file as moved
|
103 | */
|
104 | markAsMoved(fileName: string, filePath: string): void;
|
105 | /**
|
106 | * Moves the file to a given location. Multiple calls to the `move` method are allowed,
|
107 | * incase you want to move a file to multiple locations.
|
108 | */
|
109 | move(location: string, options?: {
|
110 | name?: string;
|
111 | overwrite?: boolean;
|
112 | }): Promise<void>;
|
113 | /**
|
114 | * Move file to a drive disk
|
115 | */
|
116 | moveToDisk(location: string, options?: WriteOptions & {
|
117 | name?: string;
|
118 | }, diskName?: keyof DisksList): Promise<void>;
|
119 | /**
|
120 | * Returns file JSON representation
|
121 | */
|
122 | toJSON(): {
|
123 | fieldName: string;
|
124 | clientName: string;
|
125 | size: number;
|
126 | filePath: string | undefined;
|
127 | fileName: string | undefined;
|
128 | type: string | undefined;
|
129 | extname: string | undefined;
|
130 | subtype: string | undefined;
|
131 | state: "idle" | "streaming" | "consumed" | "moved";
|
132 | isValid: boolean;
|
133 | validated: boolean;
|
134 | errors: FileUploadError[];
|
135 | meta: any;
|
136 | };
|
137 | }
|