{"name":"lockfile","description":"A simple utility for creating/checking lockfiles","keywords":["tool","fs"],"author":{"name":"Trevor Burnham"},"email":"trevorburnham@gmail.com","homepage":"http://github.com/TrevorBurnham/lockfile","repository":{"type":"git","url":"git://github.com/TrevorBurnham/lockfile.git"},"licenses":[{"type":"MIT"}],"version":"0.1.1","engines":{"node":">= 0.2.0"},"directories":{"lib":"./lib"},"main":"./lib/lockfile","_npmUser":{"name":"TrevorBurnham","email":"trevorburnham@gmail.com"},"_id":"lockfile@0.1.1","dependencies":{},"devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.105","_nodeVersion":"v0.6.2","_defaultsLoaded":true,"dist":{"shasum":"188122a8ecc5a58aff3cc54cbaf431e66a0d179f","tarball":"http://registry-npm.ywwl.com/lockfile/download/lockfile-0.1.1.tgz","integrity":"sha512-9g484ig6N8/yY9Pf/ZTS2vBY2/iuWO1RFc22WSUyIx/zOvAPNIURavjKTArayqAbRoEIn/d78z9AObyS2a759A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCC7mBcHMOHJ63cBT7RI0S8ehbmguttOGV0u4IQmpc1NQIhAJLPQJC40sgEO8uG7xo3XFjMT0vFiAeNH5Y4tP6qBeJ3"}],"size":10240,"noattachment":false,"key":"/lockfile/-/lockfile-0.1.1.tgz"},"maintainers":[{"name":"TrevorBurnham","email":"trevorburnham@gmail.com"}],"readme":"# lockfile\n\nA very polite lock file utility, which endeavors to not litter, and to\nwait patiently for others.\n\n## Usage\n\n```javascript\nvar lockFile = require('lockfile')\n\n// opts is optional, and defaults to {}\nlockFile.lock('some-file.lock', opts, function (er) {\n  // if the er happens, then it failed to acquire a lock.\n  // if there was not an error, then the file was created,\n  // and won't be deleted until we unlock it.\n\n  // do my stuff, free of interruptions\n  // then, some time later, do:\n  lockFile.unlock('some-file.lock', function (er) {\n    // er means that an error happened, and is probably bad.\n  })\n})\n```\n\n## Methods\n\nSync methods return the value/throw the error, others don't.  Standard\nnode fs stuff.\n\nAll known locks are removed when the process exits.  Of course, it's\npossible for certain types of failures to cause this to fail, but a best\neffort is made to not be a litterbug.\n\n### lockFile.lock(path, [opts], cb)\n\nAcquire a file lock on the specified path\n\n### lockFile.lockSync(path, [opts])\n\nAcquire a file lock on the specified path\n\n### lockFile.unlock(path, cb)\n\nClose and unlink the lockfile.\n\n### lockFile.unlockSync(path)\n\nClose and unlink the lockfile.\n\n### lockFile.check(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nCallback is called with `cb(error, isLocked)`.\n\n### lockFile.checkSync(path, [opts])\n\nCheck if the lockfile is locked and not stale.\n\nReturns boolean.\n\n## Options\n\n### opts.wait\n\nA number of milliseconds to wait for locks to expire before giving up.\nOnly used by lockFile.lock.  Poll for `opts.wait` ms.  If the lock is\nnot cleared by the time the wait expires, then it returns with the\noriginal error.\n\n### opts.pollPeriod\n\nWhen using `opts.wait`, this is the period in ms in which it polls to\ncheck if the lock has expired.  Defaults to `100`.\n\n### opts.stale\n\nA number of milliseconds before locks are considered to have expired.\n\n### opts.retries\n\nUsed by lock and lockSync.  Retry `n` number of times before giving up.\n\n### opts.retryWait\n\nUsed by lock.  Wait `n` milliseconds before retrying.\n","publish_time":1326994032988,"_cnpm_publish_time":1326994032988,"dist-tags":{"latest":"1.0.4"}}