Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).finally(function () {
// Unlink the file after import
return nodefn.call(fs.unlink, options.importfile.path);
});
},
getLibraryEntry: function(type,path) {
var root = fspath.join(libDir,type);
var rootPath = fspath.join(libDir,type,path);
// don't create the folder if it does not exist - we are only reading....
return nodeFn.call(fs.lstat, rootPath).then(function(stats) {
if (stats.isFile()) {
return getFileBody(root,path);
}
if (path.substr(-1) == '/') {
path = path.substr(0,path.length-1);
}
return nodeFn.call(fs.readdir, rootPath).then(function(fns) {
var dirs = [];
var files = [];
fns.sort().filter(function(fn) {
var fullPath = fspath.join(path,fn);
var absoluteFullPath = fspath.join(root,fullPath);
if (fn[0] != ".") {
var stats = fs.lstatSync(absoluteFullPath);
if (stats.isDirectory()) {
dirs.push(fn);
return nodefn.call(bcrypt.genSalt).then(function (salt) {
// Hash the provided password with bcrypt
return nodefn.call(bcrypt.hash, password, salt);
});
}
.then(function(loaded){
return nodefn.call(npm.commands.uninstall, [name]);
});
fs.exists(file, function(exists) {
if (exists) {
defer.resolve(nodeFn.call(fs.readFile,file,'utf8'));
} else {
defer.reject();
}
});
return defer.promise;
this.getUniqueFileName(this, image, targetDir).then(function (filename) {
targetFilename = filename;
return nodefn.call(fs.mkdirs, targetDir);
}).then(function () {
return nodefn.call(fs.copy, image.path, targetFilename);
function npmLoader(){
return nodefn.call(npm.load, {depth:0, silent: true});
}
.then(function(loaded){
return nodefn.call(npm.commands.search, [name]);
})
.then(function(results){
const moveInChroot = function (src, dest) {
src = getChrootPath(src)
dest = getChrootPath(dest)
const filename = path.basename(src)
dest = path.join(dest, filename)
logger.debug('Move file %s to %s', src, dest)
return nodefn.call(fs.rename, src, dest)
}