UNPKG

1.12 kBTypeScriptView Raw
1/// <reference path="../../../adonis-typings/bodyparser.d.ts" />
2import { MultipartFileContract } from '@ioc:Adonis/Core/BodyParser';
3/**
4 * Size validator validates the file size
5 */
6export declare class SizeValidator {
7 private file;
8 private maximumAllowedLimit?;
9 private bytesLimit;
10 validated: boolean;
11 /**
12 * Defining the maximum bytes the file can have
13 */
14 get maxLimit(): number | string | undefined;
15 set maxLimit(limit: number | string | undefined);
16 constructor(file: MultipartFileContract);
17 /**
18 * Reporting error to the file
19 */
20 private reportError;
21 /**
22 * Validating file size while it is getting streamed. We only mark
23 * the file as `validated` when it's validation fails. Otherwise
24 * we keep re-validating the file as we receive more data.
25 */
26 private validateWhenGettingStreamed;
27 /**
28 * We have the final file size after the stream has been consumed. At this
29 * stage we always mark `validated = true`.
30 */
31 private validateAfterConsumed;
32 /**
33 * Validate the file size
34 */
35 validate(): void;
36}