Interface FileSystemLocking

Use this backend service to help prevent race access to files on disk.

interface FileSystemLocking {
    lockPath<T>(lockPath, transaction, thisArg?): Promise<T>;
}

Implemented by

Methods

Methods

  • Get exclusive access to a file for reading and/or writing.

    Type Parameters

    • T

    Parameters

    • lockPath: string

      The path to request exclusive access to.

    • transaction: ((lockPath) => T | Promise<T>)

      The job to do while having exclusive access.

        • (lockPath): T | Promise<T>
        • Parameters

          • lockPath: string

          Returns T | Promise<T>

    • Optional thisArg: unknown

      this argument used when calling transaction.

    Returns Promise<T>