Options
All
  • Public
  • Public/Protected
  • All
Menu

Project @filestack/tools

Index

Functions

Const extensionToMime

  • extensionToMime(ext: string): undefined | string
  • Change extension to according mimetype using ext=>mimetype map

    Parameters

    • ext: string

      extension to convert

    Returns undefined | string

    string|boolean

Const filterJpeg

Const getMimetype

  • getMimetype(file: Buffer | Uint8Array, name?: string): string
  • Get file mimetype

    Parameters

    • file: Buffer | Uint8Array
    • Optional name: string

    Returns string

    • mimetype

Const isAcceptable

  • isAcceptable(input: string, accept: string | string[], trueIfNotFound?: boolean): boolean
  • Check if input string is in acceptable array of mimes

    Parameters

    • input: string

      mimetype, filename with extension or extension to check

    • accept: string | string[]

      mimetype or array of mimetype to check against

    • trueIfNotFound: boolean = true

      if mime is not found or accept array is empty what should we return

    Returns boolean

Generated using TypeDoc