SILENT KILLERPanel

Current Path: > > lib > node_modules > npm > node_modules > lockfile


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //lib/node_modules/npm/node_modules/lockfile

NameTypeSizeLast ModifiedActions
.travis.yml File 126 bytes March 10 2021 14:36:37.
CHANGELOG.md File 1825 bytes March 10 2021 14:36:37.
LICENSE File 765 bytes March 10 2021 14:36:37.
README.md File 2078 bytes March 10 2021 14:36:37.
gen-changelog.sh File 238 bytes March 10 2021 14:36:37.
lockfile.js File 8420 bytes March 10 2021 14:36:37.
package.json File 1734 bytes March 10 2021 14:36:37.
sockets.md File 700 bytes March 10 2021 14:36:37.
speedtest.js File 1378 bytes March 10 2021 14:36:37.

Reading File: //lib/node_modules/npm/node_modules/lockfile/README.md

# lockfile

A very polite lock file utility, which endeavors to not litter, and to
wait patiently for others.

## Usage

```javascript
var lockFile = require('lockfile')

// opts is optional, and defaults to {}
lockFile.lock('some-file.lock', opts, function (er) {
  // if the er happens, then it failed to acquire a lock.
  // if there was not an error, then the file was created,
  // and won't be deleted until we unlock it.

  // do my stuff, free of interruptions
  // then, some time later, do:
  lockFile.unlock('some-file.lock', function (er) {
    // er means that an error happened, and is probably bad.
  })
})
```

## Methods

Sync methods return the value/throw the error, others don't.  Standard
node fs stuff.

All known locks are removed when the process exits.  Of course, it's
possible for certain types of failures to cause this to fail, but a best
effort is made to not be a litterbug.

### lockFile.lock(path, [opts], cb)

Acquire a file lock on the specified path

### lockFile.lockSync(path, [opts])

Acquire a file lock on the specified path

### lockFile.unlock(path, cb)

Close and unlink the lockfile.

### lockFile.unlockSync(path)

Close and unlink the lockfile.

### lockFile.check(path, [opts], cb)

Check if the lockfile is locked and not stale.

Callback is called with `cb(error, isLocked)`.

### lockFile.checkSync(path, [opts])

Check if the lockfile is locked and not stale.

Returns boolean.

## Options

### opts.wait

A number of milliseconds to wait for locks to expire before giving up.
Only used by lockFile.lock.  Poll for `opts.wait` ms.  If the lock is
not cleared by the time the wait expires, then it returns with the
original error.

### opts.pollPeriod

When using `opts.wait`, this is the period in ms in which it polls to
check if the lock has expired.  Defaults to `100`.

### opts.stale

A number of milliseconds before locks are considered to have expired.

### opts.retries

Used by lock and lockSync.  Retry `n` number of times before giving up.

### opts.retryWait

Used by lock.  Wait `n` milliseconds before retrying.

SILENT KILLER Tool