Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function main ( host) {
async.waterfall([
function (cb) {
getSpeechService(host, cb);
//console.log("start");
},
// [START send_request]
function sendRequest (speechService, cb) {
console.log(chalk.green('GOOGLE SPEACH DEAMON : Analyzing speech...'));
var startOfSpeech = false;
var responses = [];
var responseTimeout = null;
var call = speechService.streamingRecognize();
// Listen for various responses
copyToMain(res, aggregateETag, params, callback) {
// move object from mpu bucket into the main bucket
// retrieve initial metadata then compose the object
const copySource = res ||
createMpuKey(params.Key, params.UploadId, 'final');
return async.waterfall([
next => {
// retrieve metadata from init object in mpu bucket
const headParams = {
Bucket: params.MPU,
Key: createMpuKey(params.Key, params.UploadId,
'init'),
};
logger.trace('retrieving object metadata');
return this.service.headObject(headParams, (err, res) => {
if (err) {
logHelper(logger, 'error',
'error in createMultipartUpload - headObject',
err);
return next(err);
}
return next(null, res);
if (err) {
return waterfallCallback(err);
}
fx.rates = result && result.rates ? result.rates : {};
fx.base = result && result.base ? result.base : 'USD';
waterfallCallback();
});
}
waterfallTasks = [getRates, fetchInvoice, savePayment, invoiceUpdater, createJournalEntry];
if (isForSale) { // todo added condition for purchase payment
waterfallTasks.push(updateWtrack);
}
async.waterfall(waterfallTasks, function (err, response) {
if (err) {
return next(err);
}
res.status(201).send(response);
});
};
if (!ballot.transaction) {
next(noRetryError({error:'missing ballot transaction'}), null);
return;
}
var web3 = new Web3();
// FIXME: read URI from the config
web3.setProvider(new web3.providers.HttpProvider(
'http://127.0.0.1:8545'
));
var signedTx = new EthereumTx(ballot.transaction);
var address = EthereumUtil.bufferToHex(signedTx.getSenderAddress());
var rootAccount = null;
async.waterfall(
[
(callback) => updateBallotStatus(
ballot,
'pending',
(err, dbBallot) => callback(err)
),
// Step 0: we make sure the ballot account is a new account.
// Each account is unique: one vote => one account => one address. If
// the address already has some funds, then it was used before and
// something fishy is happening:
// 1) someone is tempering with the platform; or
// 2) the worker stopped/crashed after initializing the account but
// before sending the vote transaction to the blockchain: not cool, but
// it's safer to throw an error and ask the user to vote again.
// (callback) => accountIsNotInitialized(web3, address, callback),
(callback) => web3.eth.getAccounts((err, acc) => {
// chmod dst
chmod = async.apply(fs.chmod, dst, stats.mode.toString(8).slice(-4));
// reject async.series' results
done = function (err/*, results */) { callback(err); };
// *** file
if (stats.isFile()) {
async.series([async.apply(copy_file, src, dst), chmod], done);
return;
}
// *** symbolic link
if (stats.isSymbolicLink()) {
async.waterfall([
function (next) {
fs.exists(dst, function (exists) {
if (exists) {
fstools.remove(dst, next);
return;
}
next();
});
},
async.apply(fs.readlink, src),
function (linkpath, next) {
fs.symlink(linkpath, dst, next);
},
chmod
], done);
function remove(req, res) {
log.info("[ REPOS ] Delete repo ");
async.waterfall([
(cb) => Checker.checkParams(req.params, ['name'], cb),
(cb) => repos.remove(req.params.name, cb)
], (err, results) => {
appUtils.response("Delete repo", res, err, results);
});
}
storeHandlers.FLAGS = function(connection, messages, isUid, flags, parsed, data, cb) {
async.waterfall([
function (cb) {
connection.replaceFlags(messages, isUid, _.pluck(flags,"value"), cb);
},
function (msgs,cb) {
sendUpdate(connection, parsed, data, msgs, cb);
}
],cb);
};
IOS.prototype.typeAndNavToUrl = function (cb) {
var initialUrl = this.args.safariInitialUrl || 'http://127.0.0.1:' + this.args.port + '/welcome';
var oldImpWait = this.implicitWaitMs;
this.implicitWaitMs = 7000;
function noArgsCb(cb) { return function (err) { cb(err); }; }
async.waterfall([
this.findElement.bind(this, 'name', 'URL'),
function (res, cb) {
this.implicitWaitMs = oldImpWait;
this.nativeTap(res.value.ELEMENT, noArgsCb(cb));
}.bind(this),
this.findElements.bind(this, 'name', 'Address'),
function (res, cb) {
var addressEl = res.value[res.value.length -1].ELEMENT;
this.setValueImmediate(addressEl, initialUrl, noArgsCb(cb));
}.bind(this),
this.findElement.bind(this, 'name', 'go'),
function (res, cb) {
this.nativeTap(res.value.ELEMENT, noArgsCb(cb));
}.bind(this)
], function () {
this.navToViewWithTitle(/.*/i, function (err) {
this.onConnect = function () {
logger.debug("Firefox OS socket connected");
var mainCb = cb;
async.waterfall([
function (cb) { this.getMarionetteId(cb); }.bind(this),
function (cb) { this.createSession(cb); }.bind(this),
function (cb) { this.launchAppByName(cb); }.bind(this),
function (frameId, cb) { this.frame(frameId, cb); }.bind(this)
], function () { mainCb(null, this.sessionId); }.bind(this));
};
sendDone() {
return Async.waterfall([
next => this.enCrypto(JSON.stringify({ done: new Date().toISOString() }), next),
(data, next) => this.trySendToRemote(buffer_1.Buffer.from(data), next)
], (err) => {
if (err)
return saveLog(`sendDone got error [${err.message}]`);
});
}
}