Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace ownUtils

Index

Functions

extensionToMimetype

  • extensionToMimetype(ext: string): string
  • Map an extension or file type to a mime type

    throws

    error when the mimetype for the given extension is not found

    Parameters

    • ext: string

      extension where we want the mimetype for

    Returns string

    mime type of the given extension

mimetypeToExtension

  • mimetypeToExtension(mimetype: string): string
  • Map a mime type to an extension or file type

    throws

    error when the extension for the given mimetype is not found

    Parameters

    • mimetype: string

      mimetype where we want the extension for

    Returns string

    filetype or extension corresponding to the given mimetype

pathToExtension

  • pathToExtension(filepath: string): string
  • Cut off the extension from a file path Example: '/path/to/file.docx' -> 'docx'

    Parameters

    • filepath: string

      file path to handle

    Returns string

    the file's type or extension

rawToBase64

  • rawToBase64(rawData: Buffer): string
  • Convert raw data to a base64 string

    Parameters

    • rawData: Buffer

      a Buffer containing the raw data

    Returns string

    base64 string of the raw data

readFileAsBase64

  • readFileAsBase64(path: string): string
  • Read a local file as a base64 string

    Parameters

    • path: string

      path of the local file

    Returns string

    base64 representation of the file

Generated using TypeDoc