(function _getUniqueName() {
const name = _generateTmpName(opts);
// check whether the path exists then retry if needed
fs.stat(name, function (err) {
/* istanbul ignore else */
if (!err) {
/* istanbul ignore else */
if (tries-- > 0) return _getUniqueName();
return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));
}
cb(null, name);
});
}());
Here, it reads if (!err) whereas it should read if(err).
Here, it reads
if (!err)
whereas it should readif(err)
.