How to use the when/node/function.call function in when

To help you get started, we’ve selected a few when 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 ohmlabs / ohm / server / ghost / core / server / api / db.js View on Github external
}).finally(function () {
            // Unlink the file after import
            return nodefn.call(fs.unlink, options.importfile.path);
        });
    },
github node-red / node-red / red / runtime / storage / localfilesystem.js View on Github external
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);
github ohmlabs / ohm / server / ghost / core / server / models / user.js View on Github external
return nodefn.call(bcrypt.genSalt).then(function (salt) {
        // Hash the provided password with bcrypt
        return nodefn.call(bcrypt.hash, password, salt);
    });
}
github octoblu / legacy-gateway / lib / pluginMetaData.js View on Github external
.then(function(loaded){
    return nodefn.call(npm.commands.uninstall, [name]);
  });
github megamsys / varai / varai / actions / localfilesystem.js View on Github external
fs.exists(file, function(exists) {
            if (exists) {
                defer.resolve(nodeFn.call(fs.readFile,file,'utf8'));
            } else {
                defer.reject();
            }
        });
        return defer.promise;
github ohmlabs / ohm / server / ghost / core / server / storage / localfilesystem.js View on Github external
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);
github octoblu / legacy-gateway / lib / pluginMetaData.js View on Github external
function npmLoader(){
  return nodefn.call(npm.load, {depth:0, silent: true});
}
github octoblu / legacy-gateway / lib / pluginMetaData.js View on Github external
.then(function(loaded){
    return nodefn.call(npm.commands.search, [name]);
  })
  .then(function(results){
github nunux-keeper / keeper-core-api / src / helper / files.js View on Github external
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)
}