Utility methods related with input/output operations on files.

Constructors

  • Returns io

Methods

  • Parameters

    • filepath: string | File

      path to the file to be copied

    • destination: string | File

      path to the destination file

    Returns boolean

    true if the file was copied successfully

  • Parameters

    • filepath: string | File

      path to the file to be copied

    • destination: string

      path to the destination file

    • verbose: boolean = false

      enables additional information

    Returns boolean

    true if the folder was copied successfully

  • Parameters

    • fileOrBaseFolder: string | File

      File object or path to the base folder

    • OptionaloptionalFile: string | File

      Optional child pathname or file

    Returns boolean

    if the delete operation on the given file was successfull.

  • Deletes a folder and its contents.

    Parameters

    • folderPath: string | File

      File object or path to the folder

    Returns boolean

    true if both the contents and the folder could be deleted

  • Deletes the contents of a folder.

    Parameters

    • folderPath: string | File

      File object or path to the folder

    Returns boolean

    true if the content of the folder could be deleted

  • Parameters

    • fileOrBaseFolder: string | File

      File object or path to the base folder

    • OptionaloptionalFile: string | File

      Optional child pathname or file

    Returns string

    the absolute path of the given file

  • The files inside the given folder that respects the given pattern.

    Parameters

    • baseFolder: string | File = "./"

      File object or path to the base folder

    • pattern: string | any[] = "*"

      Pattern to match

    • isRecursive: boolean = false

      If true, search recursively inside the folder

    Returns File[]

    the files inside the given folder that respects the given pattern.

  • Parameters

    • baseFolder: string | File

      File object or path to the base folder

    • Rest...args: string[]

      Patterns to match

    Returns File[]

    the folders in the given folder, corresponding to the given base folder and argument patterns.

  • Parameters

    • fileOrBaseFolder: string | File

      File object or path to the base folder

    • OptionaloptionalFile: string | File

      Optional child pathname or file, if absolute ignores fileorBaseFolder

    Returns File

    new File object with path given

  • Parameters

    • baseFolder: string | File

      File object or path to the base folder

    • Rest...args: string[]

      Patterns to match

    Returns File[]

    the paths (files and folders) in the given folder, corresponding to the given base folder and argument patterns.

  • Parameters

    • targetFile: string | File

      The target file for which the relative path is calculated.

    • baseFile: string | File

      The base file against which the relative path is calculated

    Returns undefined | string

    the path of 'targetFile', relative to 'baseFile' or undefined if the file does not share a common ancestor with baseFile.

  • If folderName is undefined, returns the OS temporary folder. If defined, creates a new folder inside the system's temporary folder and returns it.

    Parameters

    • OptionalfolderName: string

      Optional name for the temporaray folder

    Returns File

    the OS temporary folder or the created folder

  • If value is a string that ends in .json, assume it is a file to a json object and parses it. If it is a string but does not end in json, assume it is a stringified object. Otherwise, returns the object as it is.

    Type Parameters

    • T

    Parameters

    • value: T

    Returns string | T

    Use JSON.parse() instead or fileToJSON from api/core/output.js

  • Parameters

    • fileOrBaseFolder: string | File

      File object or path to the file

    • OptionaloptionalFile: string | File

      Optional child pathname or file

    Returns string

    the MD5 checksum of the file represented as a hexadecimal string.

    RuntimeException if there are any issues while reading the file or calculating the MD5 checksum

  • Creates a folder.

    Parameters

    • fileOrBaseFolder: string | File

      File object or path to the base folder

    • OptionaloptionalFile: string | File

      Optional child pathname or file, if absolute ignores fileorBaseFolder

    Returns File

    the created folder

  • Parameters

    • fileOrBaseFolder: string | File

      File object or path to the base folder

    • OptionaloptionalFile: string | File

      Optional child pathname or file

    Returns string[]

    a List with a string for each line of the given file