Options
All
  • Public
  • Public/Protected
  • All
Menu

Utility class containing a bunch of helper methods for commonly used file system interactions and other methods
as shortcuts.

Hierarchy

  • FileUtil

Index

Methods

Static createOrUpdateFile

  • createOrUpdateFile(filePath: any, fileContent: any): Promise<void>
  • createOrUpdateFile(filePath: string, fileContent: any, callback: (error: ErrnoException) => any): Promise<void>
  • createOrUpdateFile(filePath: string, fileContent: any, options: CreateOrUpdateFileOptions, callback: (error: ErrnoException) => any): Promise<void>
  • Asynchronously attempts to create or update a file with the provided path and content. Uses the defaults for
    options and callback.

    static
    throws

    {Error} An error can be thrown if the file system fails to create the directory, fails to create
    the file, or files to update the file. The main process should be able to process any thrown errors.

    Parameters

    • filePath: any

      The path to the file that is being created or updated.

    • fileContent: any

      The file's content.

    Returns Promise<void>

  • Asynchronously attempts to create or update a file with the provided path and content. Uses the defaults for
    options.

    static
    throws

    {Error} An error can be thrown if the file system fails to create the directory, fails to create
    the file, or files to update the file. The provided callback should be able to process any thrown errors.

    Parameters

    • filePath: string

      The path to the file that is being created or updated.

    • fileContent: any

      The file's content.

    • callback: (error: ErrnoException) => any

      The callback function to execute if an error is thrown. Note:
      This is only run if an error is thrown.

        • (error: ErrnoException): any
        • Parameters

          • error: ErrnoException

          Returns any

    Returns Promise<void>

  • Asynchronously attempts to create or update a file with the provided path and content. Additional
    configurations can be handled by the options argument.

    static
    throws

    {Error} An error can be thrown if the file system fails to create the directory, fails to create
    the file, or files to update the file. The provided callback should be able to process any thrown errors.

    Parameters

    • filePath: string

      The path to the file that is being
      created or updated.

    • fileContent: any

      The file's content.

    • options: CreateOrUpdateFileOptions

      The options used to provide
      additional functionality.

    • callback: (error: ErrnoException) => any

      The callback function to execute
      if an error is thrown. Note: This is only run if an error is thrown.

        • (error: ErrnoException): any
        • Parameters

          • error: ErrnoException

          Returns any

    Returns Promise<void>

Static createOrUpdateFileSync

  • createOrUpdateFileSync(filePath: string, fileContent: any): void
  • createOrUpdateFileSync(filePath: string, fileContent: any, options: CreateOrUpdateFileOptions): void
  • Synchronously attempts to create or update a file with the provided path and content. Ues the defaults for
    options. Synchronous version of createOrUpdateFile.

    static
    throws

    {Error} An error can be thrown if the file system fails to create the directory, fails to create the
    file, or fails to update the file. The main process should be able to process any thrown errors.

    Parameters

    • filePath: string

      The path to the file that is being created or updated.

    • fileContent: any

      The file's content.

    Returns void

  • Synchronously attempts to create or update a file with the provided path and content. Synchronous
    version of createOrUpdateFile.

    static
    throws

    {Error} An error can be thrown if the file system fails to create the directory, fails to create the
    file, or fails to update the file. The main process should be able to process any thrown errors.

    Parameters

    • filePath: string

      The path to the file that is being
      created or updated.

    • fileContent: any

      The file's content.

    • options: CreateOrUpdateFileOptions

      The options used to provide
      additional functionality.

    Returns void

Constructors

constructor

Generated using TypeDoc