Class FileType<TVal>

A class that defined a custom file type as well as the logic to recognise it

Type Parameters

  • TVal extends string

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • TVal extends string

    Parameters

    • name: TVal

      The name of the filetype

    • OptionalmimeTypes: string[]

      Mimetypes for recognising the file type

    • Optionalextensions: string[]

      File extensions for recognising the file type

    • OptionalcustomMatch: ((type: string) => boolean)

      Custom logic to match the mimetype of the file

        • (type): boolean
        • Parameters

          • type: string

          Returns boolean

    Returns FileType<TVal>

Properties

extensions?: string[]

File extensions for recognising the file type

mimeTypes?: string[]

Mimetypes for recognising the file type

name: TVal

The name of the filetype

Accessors

Methods

  • Checks if a file is a match

    Parameters

    • file: File

      The file to check against

    Returns boolean

  • Checks if a file is a match based on the filename and mimetype

    Parameters

    • filename: string

      The filename of the file

    • type: string

      The mimetype of the file

    Returns boolean