FileTypeValidator
Defines the built-in FileType File Validator. It validates incoming files mime-type matching a string or a regular expression. Note that this validator uses a naive strategy to check the mime-type and could be fooled if the client provided a file with renamed extension. (for instance, renaming a 'malicious.bat' to 'malicious.jpeg'). To handle such security issues with more reliability, consider checking against the file's magic-numbers
class FileTypeValidator extends FileValidator {
buildErrorMessage(): string
isValid(file: any): boolean
// inherited from nest/packages/common/FileValidator
constructor(validationOptions: TValidationOptions)
protected validationOptions: TValidationOptions
abstract isValid(file?: any): boolean | Promise<boolean>
abstract buildErrorMessage(file: any): string
}
See also
Methods
buildErrorMessage() |
---|
ParametersThere are no parameters. Returns
|
isValid() |
---|