@adonisjs/bodyparser
Version:
AdonisJs body parser to read and parse HTTP request bodies
37 lines (36 loc) • 1.12 kB
TypeScript
/// <reference path="../../../adonis-typings/bodyparser.d.ts" />
import { MultipartFileContract } from '@ioc:Adonis/Core/BodyParser';
/**
* Size validator validates the file size
*/
export declare class SizeValidator {
private file;
private maximumAllowedLimit?;
private bytesLimit;
validated: boolean;
/**
* Defining the maximum bytes the file can have
*/
get maxLimit(): number | string | undefined;
set maxLimit(limit: number | string | undefined);
constructor(file: MultipartFileContract);
/**
* Reporting error to the file
*/
private reportError;
/**
* Validating file size while it is getting streamed. We only mark
* the file as `validated` when it's validation fails. Otherwise
* we keep re-validating the file as we receive more data.
*/
private validateWhenGettingStreamed;
/**
* We have the final file size after the stream has been consumed. At this
* stage we always mark `validated = true`.
*/
private validateAfterConsumed;
/**
* Validate the file size
*/
validate(): void;
}