How to use the mkdirp.bind function in mkdirp

To help you get started, we’ve selected a few mkdirp 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 sebpiq / fields / backend / main.js View on Github external
HTTPServer.prototype.validateConfig = function(done) { done() }

// Rhizome servers and connection manager
manager = new rhizome.connections.ConnectionManager({ store: config.server.tmpDir })
httpServer = new HTTPServer()
wsServer = new rhizome.websockets.Server({ serverInstance: httpServer._httpServer })
oscServer = new rhizome.osc.Server({ port: config.osc.port })

// Set error handlers
;([wsServer, oscServer, manager]).forEach((server) => {
  server.on('error', (err) => console.error(err.stack ? err.stack : err))
})

// Create tmp and build folders
asyncOps.push(mkdirp.bind(mkdirp, buildDir))

// If `config.instruments` are provided, write it to a config file
if (config.instruments) {
  asyncOps.push(
    fs.writeFile.bind(fs, instrumentConfigFile, 'fields.config = ' + config.instruments.toString())
  )
}

// Start servers
asyncOps.push(rhizome.starter.bind(rhizome.starter, manager, [oscServer, httpServer, wsServer]))

// Async operations
async.series(asyncOps, function(err) {
  if (err) throw err
  console.log(clc.bold('Fields ' + version +' running') )
  console.log(clc.black('GPL license. Copyright (C) 2016 Sébastien Piquemal, Tim Shaw'))
github alexanderGugel / ied / lib / install.js View on Github external
function linkPkg (dir, pkg, cb) {
  var dstPath = path.join(dir, 'node_modules', pkg.name)
  var srcPath = path.relative(
    path.join(dstPath, 'node_modules'),
    path.join(dir, 'node_modules', pkg.uid)
  )

  // path.dirname('@hello/world') #=> 'hello'
  // path.dirname('world') #=> '.'
  async.series([
    mkdirp.bind(null, path.join(dir, 'node_modules', path.dirname(pkg.name))),
    forceSymlink.bind(null, srcPath, dstPath, config.symlinkType)
  ], cb)
}
github racker / dreadnot / lib / util / git.js View on Github external
exports.clone = function(repo, url, callback) {
  async.series([
    // 0755 = 493
    mkdirp.bind(null, path.dirname(repo), 493),
    git.bind(null, ['clone', url, repo])
    ],
    function(err) {
      callback(err);
  });
};
github PacktPublishing / Node.js_Design_Patterns_Second_Edition_Code / Chapter03 / 07_async_sequential_execution / index.js View on Github external
function download(url, filename, callback) {
  console.log(`Downloading ${url}`);
  let body;

  async.series([
    callback => {           //[1]
      request(url, (err, response, resBody) => {
        if(err) {
          return callback(err);
        }
        body = resBody;
        callback();
      });
    },

    mkdirp.bind(null, path.dirname(filename)),    //[2]

    callback => {           //[3]
      fs.writeFile(filename, body, callback);
    }
  ], err => {         //[4]
    if(err) {
      return callback(err);
    }
    console.log(`Downloaded and saved: ${url}`);
    callback(null, body);
  });
}
github loldevs / lol-observer / lib / game.js View on Github external
Game.prototype.downloadChunk = co(function *(dir, id) {
    try {
        yield mkdirp.bind(null, dir + '/chunks')
    }
    catch (err) {
        return console.error(err)
    }
    var ws       = fs.createWriteStream(dir + '/chunks/' + id)
    var decipher = crypto.createDecipheriv('bf-ecb', this.cryptoKey, "")
    var gunzip   = zlib.createGunzip()
    var url      = this.baseUrl + 'consumer/getGameDataChunk/' + this.region + '/' + this.id + '/' + id + '/token'

    console.log('[', id, '] GET ', url)
    var req = http.request(url, function(res) {
        console.log('[', id, ']', res.statusCode)
        if(res.statusCode !== 200) {
            console.log('ERR[', id, '] HTTP:', res.statusCode, res.headers)
            return;
        }
github chill117 / geoip-native-lite / lib / data.js View on Github external
setup: function(cb) {

		log('Setting up...');

		async.series([
			mkdirp.bind(undefined, config.dataDir),
			mkdirp.bind(undefined, config.tmpDir)
		], function(error) {

			if (error) {
				return cb(error);
			}

			cb();
		});
	}
};
github joyent / node-debug-school / lib / core / dumpcore_sunos.js View on Github external
module.exports = function dumpCore(scriptPath, destDirectory, options, callback) {
  if (typeof options === 'function') {
    callback = options;
    options = null;
  }

  var coreDumpProgressMsg;
  if (options && options.progress) {
    coreDumpProgressMsg = progressMsg.startProgressMsg(CORE_DUMPS_PROGRESS_MSG,
                                                       CORE_DUMPS_PROGRESS_DELAY);
  }
  async.series([
    mkdirp.bind(global, destDirectory),
    generateCoreDump.bind(global, scriptPath, destDirectory)
  ], function coreDumped(err, results) {
    if (coreDumpProgressMsg) {
      progressMsg.stopProgressMsg(coreDumpProgressMsg);
    }
    if (err) {
      debug('Error when dumping core: ' + err);
    }
    return callback(err, results[1]);
  });
}
github chill117 / geoip-native-lite / lib / data.js View on Github external
setup: function(cb) {

		log('Setting up...');

		async.series([
			mkdirp.bind(undefined, config.dataDir),
			mkdirp.bind(undefined, config.tmpDir)
		], function(error) {

			if (error) {
				return cb(error);
			}

			cb();
		});
	}
};
github joeferner / node-http-mitm-proxy / lib / ca.js View on Github external
CA.create = function (caFolder, callback) {
  var ca = new CA();
  ca.baseCAFolder = caFolder;
  ca.certsFolder = path.join(ca.baseCAFolder, 'certs');
  ca.keysFolder = path.join(ca.baseCAFolder, 'keys');
  async.series([
    mkdirp.bind(null, ca.baseCAFolder),
    mkdirp.bind(null, ca.certsFolder),
    mkdirp.bind(null, ca.keysFolder),
    function (callback) {
      FS.exists(path.join(ca.certsFolder, 'ca.pem'), function (exists) {
        if (exists) {
          ca.loadCA(callback);
        } else {
          ca.generateCA(callback);
        }
      });
    }
  ], function (err) {
    if (err) {
      return callback(err);
    }
    return callback(null, ca);
  });
github nodejitsu / module-smith / lib / builder.js View on Github external
}).map(function (directory) {
      return mkdirp.bind(mkdirp, buildDescription.directories[directory]);
    }), function (err) {
      callback(err, buildDescription);

mkdirp

Recursively mkdir, like `mkdir -p`

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis