Documentation
    Preparing search index...

    Utility class providing synchronous and asynchronous file system operations specifically tailored for the worker environment (e.g., managing temp folders, downloading remote files).

    Index

    Constructors

    Methods

    • Downloads a file from an external HTTP/HTTPS URL into the local filesystem.

      Parameters

      • url: string

        The remote resource URL.

      • filepath: string

        The local destination path.

      Returns Promise<unknown>

      A promise resolving when the download finishes.

      If the HTTP request or stream fails.

    • Return meta data on given file

      Parameters

      • file: string

      Returns Promise<any>

    • Synchronously creates a single directory.

      Parameters

      • folder: string

        The directory path.

      Returns void

    • Prepares a clean processing directory, creating it along with required subdirectories (images, vecto). Any existing folder with the same name will be deleted first.

      Parameters

      • folder: string

        The base directory path to set up.

      Returns void

    • Recursively and synchronously removes a folder and its entire contents.

      Parameters

      • folder: string

        The target directory to destroy.

      • recursively: boolean = true

        Whether to traverse and delete nested folders. Defaults to true.

      Returns void

      If recursively is false but nested folders are encountered.

    • Sanitizes a string to be used safely as a filename by replacing spaces with underscores.

      Parameters

      • name: string

        The original string.

      Returns string

      The sanitized string.

    • Upload file to public URL and return meta data

      Parameters

      • filename: string

        string

      • meta: FileType
      • mime: string = 'video/mp4'

      Returns Promise<FileType>

      Promise