UNPKG

723 BTypeScriptView Raw
1/**
2 * Interface describing FileValidators, which can be added to a {@link ParseFilePipe}.
3 */
4export declare abstract class FileValidator<TValidationOptions = Record<string, any>> {
5 protected readonly validationOptions: TValidationOptions;
6 constructor(validationOptions: TValidationOptions);
7 /**
8 * Indicates if this file should be considered valid, according to the options passed in the constructor.
9 * @param file the file from the request object
10 */
11 abstract isValid(file?: any): boolean | Promise<boolean>;
12 /**
13 * Builds an error message in case the validation fails.
14 * @param file the file from the request object
15 */
16 abstract buildErrorMessage(file: any): string;
17}