Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function lock_and_read(name, cb) {
locker.readFile(name, {lock: true}, function(err, res) {
if (err) {
return cb(err);
}
return cb(null, res);
});
}
export function lockAndRead(name: string, cb: Callback): void {
locker.readFile(name, { lock: true }, (err, res) => {
if (err) {
return cb(err);
}
return cb(null, res);
});
}
const lock_and_read = function(name, cb) {
locker.readFile(name, {lock: true}, function(err, res) {
if (err) {
return cb(err);
}
return cb(null, res);
});
};
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);
}
);