Options
All
  • Public
  • Public/Protected
  • All
Menu

Utils for uploading to the server.

Here are different stub- or helper functions that are used in the system in order to implement the upload feature to the server.

The allowed filetypes for uploading are specified in the ALLOWED_FILE_EXTS:

  • jpg
  • png
  • jpeg
  • gif

Index

Variables

Const ALLOWED_FILE_EXTS

ALLOWED_FILE_EXTS: string[] = ...
constant

ALLOWED_FILE_EXTS Specifies which file extentions that are allowed in the system

Const ICON_PREFIX

ICON_PREFIX: "icon_" = 'icon_'
constant

iconPrefix prefix for what to name the icons that are smaller than regular icon images

Const MAX_FILE_SIZE

MAX_FILE_SIZE: "3mb" = '3mb'
constant

MAX_FILE_SIZE Specifies the maximum size for uploading a file

Const PIN_IMG_HEIGHT

PIN_IMG_HEIGHT: 50 = 50
constant

PIN_IMG_HEIGHT Specifies the pin imgage hegiht to be scaled to

Functions

attemptFileRemoval

  • attemptFileRemoval(name?: string): void
  • Attempts a file removal from the server with a given filename

    Parameters

    • Optional name: string

      name of the file to remove from the system

    Returns void

attemptFileUpload

  • attemptFileUpload(file?: MultipartFileContract, isIcon?: boolean): Promise<null | string>
  • Attempts a file upload to the server with a given file

    Parameters

    • Optional file: MultipartFileContract
    • Optional isIcon: boolean

    Returns Promise<null | string>

compressFile

  • compressFile(tmpPath: string, outName: string, extName?: string): Promise<void>
  • Compresses a file

    todo

    Add new field in models for a mobile optimized image

    Parameters

    • tmpPath: string

      The path where sharp will find the file

    • outName: string

      The name of the output file after compression

    • Optional extName: string

      The extention in the input file

    Returns Promise<void>

compressIconFile

  • compressIconFile(tmpPath: string, outName: string): Promise<void>
  • Compresses a file (icon)

    todo

    Add new field in models for a mobile optimized image

    Parameters

    • tmpPath: string

      The path where sharp will find the file

    • outName: string

      The name of the output file after compression

    Returns Promise<void>

Generated using TypeDoc