Function withLock

  • Executes the callback with locking the given file before, and releasing it after the callback is executed.

    Generally, the callback/operation should target the file locked.

    Type Parameters

    • T

    Parameters

    • file: string

      The path of the file to lock.

    • callback: LockCallback<T>

      The function to execute while the file is locked.

    Returns Promise<T>

  • Executes the callback with locking the given file before, and releasing it after the callback is executed.

    Generally, the callback/operation should target the file locked.

    Type Parameters

    • T

    Parameters

    • file: string

      The path of the file to lock.

    • options: LockOptions

      The lock options/timeout.

    • callback: LockCallback<T>

      The function to execute while the file is locked.

    Returns Promise<T>

Generated using TypeDoc