Interface LockFileOptions

Lock file options.

interface LockFileOptions {
    lockName?: string;
    staleAfter?: number;
}

Properties

lockName?: string

The lock file name.

Is a template which accepts placeholders, such as:

  • [path] -- The original file path.
  • [root] -- root from parse(path).
  • [dir] -- dir from parse(path).
  • [base] -- base from parse(path).
  • [name] -- name from parse(path).
  • [ext] -- ext from parse(path).
  • [hash] -- Hashed content of the original file path.
  • [slug] -- The original file path in which all "/" are replaced with "~".

Examples for the original file name "/var/lib/my-file.txt":

  • "[path]" => "/var/lib/my-file.txt"
  • "[path].lock" => "/var/lib/my-file.txt.lock"
  • "/run/lock/[base]" => "/run/lock/my-file.txt"
  • "/run/lock/[base].lock" => "/run/lock/my-file.txt.lock"
  • "/run/lock/[name][ext].lock" => "/run/lock/my-file.txt.lock"
  • "/run/lock/[name]-lock[ext]" => "/run/lock/my-file-lock.txt"
  • "/run/lock/[hash]" => "/run/lock/49f30f4f6f29dac946c10832cd87cf3f"
  • "/run/lock/[slug]" => "/run/lock/~var~lib~my-file.txt"

The default value is [path].lock.

staleAfter?: number

The number of millis after which a file is considered stale. The default value is one hour.