How to use @verdaccio/file-locking - 8 common examples

To help you get started, we’ve selected a few @verdaccio/file-locking examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github verdaccio / verdaccio / src / plugins / htpasswd / utils.js View on Github external
function lock_and_read(name, cb) {
  locker.readFile(name, {lock: true}, function(err, res) {
    if (err) {
      return cb(err);
    }
    return cb(null, res);
  });
}
github verdaccio / verdaccio-htpasswd / src / utils.ts View on Github external
export function lockAndRead(name: string, cb: Callback): void {
  locker.readFile(name, { lock: true }, (err, res) => {
    if (err) {
      return cb(err);
    }

    return cb(null, res);
  });
}
github verdaccio / verdaccio / src / lib / storage / local / local-fs.js View on Github external
const lock_and_read = function(name, cb) {
  locker.readFile(name, {lock: true}, function(err, res) {
    if (err) {
      return cb(err);
    }
    return cb(null, res);
  });
};
github verdaccio / local-storage / src / local-fs.ts View on Github external
private _lockAndReadJSON(name: string, cb: Function) {
    const fileName: string = this._getStorage(name);

    readFile(
      fileName,
      {
        lock: true,
        parse: true
      },
      (err, res) => {
        if (err) {
          this.logger.trace({ name }, '[local-storage/_lockAndReadJSON] read new file: @{name} has failed');

          return cb(err);
        }

        this.logger.trace({ name }, '[local-storage/_lockAndReadJSON] file: @{name} read');
        return cb(null, res);
      }
    );
github verdaccio / verdaccio / src / plugins / htpasswd / utils.js View on Github external
function unlock_file(name, cb) {
  locker.unlockFile(name, cb);
}
github verdaccio / verdaccio-htpasswd / src / utils.ts View on Github external
export function unlockFile(name: string, cb: Callback): void {
  locker.unlockFile(name, cb);
}
github verdaccio / verdaccio / src / lib / storage / local / local-fs.js View on Github external
const unlock_file = function(name, cb) {
  locker.unlockFile(name, cb);
};
github verdaccio / local-storage / src / local-fs.ts View on Github external
private _unlockJSON(name: string, cb: Function) {
    unlockFile(this._getStorage(name), cb);
  }
}

@verdaccio/file-locking

library that handle file locking

MIT
Latest version published 2 years ago

Package Health Score

68 / 100
Full package analysis