Defines the built-in FileTypeValidator. It validates incoming files by examining
their magic numbers using the file-type package, providing more reliable file type validation
than just checking the mimetype string.
class FileTypeValidator extends FileValidator {
buildErrorMessage(file?: IFile): string
isValid(file?: IFile): Promise<boolean>
constructor(validationOptions: TValidationOptions)
protected validationOptions: TValidationOptions
abstract isValid(file?: TFile | TFile[] | Record<string, TFile[]>): boolean | Promise<boolean>
abstract buildErrorMessage(file: any): string
}
Methods
buildErrorMessage()
|
buildErrorMessage(file?: IFile): string
Parameters
Option |
Type |
Description |
file
|
IFile |
Optional. Default is undefined .
|
Returns
string
|
isValid()
|
isValid(file?: IFile): Promise<boolean>
Parameters
Option |
Type |
Description |
file
|
IFile |
Optional. Default is undefined .
|
Returns
Promise<boolean>
|