Home > @rushstack/node-core-library > LockFile > tryAcquire

LockFile.tryAcquire() method

Attempts to create a lockfile with the given filePath.


static tryAcquire(resourceFolder: string, resourceName: string): LockFile | undefined;


Parameter Type Description
resourceFolder string The folder where the lock file will be created
resourceName string An alphanumeric name that describes the resource being locked. This will become the filename of the temporary file created to manage the lock.


LockFile | undefined

If successful, returns a LockFile instance. If unable to get a lock, returns undefined.