@pnpm/fs-locker
An fs locker for pnpm
Last updated 7 years ago by zkochan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @pnpm/fs-locker 
SYNC missed versions from official npm registry.

@pnpm/fs-locker

An fs locker for pnpm

npm version Build Status

Installation

npm i -S @pnpm/fs-locker

Usage

'use strict'
const lock = require('@pnpm/fs-locker').default
const path = require('path')

const locks = path.resolve('_locks')

lock(process.cwd(), {stale: 100, locks})
  .then(unlock => {
    // do some stuff...
    return unlock() // or unlock.sync()
  })
  .then(() => {
    console.log('folder unlocked')
    //> folder unlocked
  })
  .catch(err => console.error(err))

API

lock(filename, opts) => unlock[.sync]()

Locks the specified file. Returns an async and sync unlock function.

Arguments

  • filename - the file to lock
  • opts.stale - duration in milliseconds in which the lock is considered stale
  • opts.locks - the folder that contains the lock files
  • opts.whenLocked - function that is called if a lock is found when trying to create the lock

License

MIT © Zoltan Kochan

Current Tags

  • 3.0.1                                ...           latest (7 years ago)
  • 3.0.1                                ...           next (7 years ago)

6 Versions

  • 3.0.1                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 1.0.3                                ...           7 years ago
  • 1.0.2                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (2)
Dev Dependencies (5)

Copyright 2013 - present © cnpmjs.org | Home |