Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
res.on('end', function () {
var stitch = chunks.join("");
var response;
try {
response = JSON.parse(stitch);
} catch (e) {
console.log(clc.red("ERROR"), e)
console.log(stitch);
return;
}
if (response.error) {
console.log(clc.red("ERROR"), response);
} else if (response.status === "OK") {
console.log(clc.green("SUCCESS") +" Deploy successful");
}
});
});
}, err => {
console.log(clc.red(`Failed to download file from ${err.url}`));
});
}
.catch(e => {
console.log(clc.red(e))
that.help()
})
.finally(function() {
request.get('messages', function (err, httpResponse, body) {
if (err || httpResponse.statusCode != 200) {
console.error('Couldn\'t connect to the API to get the messages');
return;
}
var messages = selectMessages(JSON.parse(body).result || {}, config.messageCount);
if (messages.length == 0) {
console.error(clc.red('No messages to show'));
return;
}
printMessages(messages);
promptSend(messages);
});
attrs.forEach(function (attr) {
tagStr = tagStr.replace(attr, cliColor.red(attr));
});
}
function suspendProc(count) {
toSuspend = +count;
var suspended = [];
while (suspended.length < toSuspend) {
var rand = Math.floor(Math.random() * procs.length);
var proc = procs[rand];
if (proc.killed === null && proc.suspended === null) {
logMsg(proc.port, color.green('pid ' + proc.pid) + color.red(' randomly selected for sleep'));
process.kill(proc.proc.pid, 'SIGSTOP');
proc.suspended = Date.now();
suspended.push(proc);
}
}
}
private async extractSWF(swf: { name: string, rawData: Buffer }): Promise<{ name: string, images: Image[], symbols: string[] }> {
const { name, rawData } = swf
Logger.info(`${blueBright('[EXTRACTING]')}${cyan('[SWF]')} ${name}`)
let { tags } = await readFromBufferP(rawData)
Logger.info(`${blueBright('[EXTRACTING]')}${red('[IMAGES]')} ${name}`)
const images = await Promise.all(extractImages(tags))
tags = tags.filter(tag => {
return tag.code === 76
})
Logger.info(`${blueBright('[EXTRACTING]')}${yellow('[SYMBOLS]')} ${name}`)
const symbols = this.extractSymbols(tags)
Logger.info(`${blueBright('[EXTRACTING]')}${green('[DONE]')} ${name}`)
return { name, images, symbols }
}
let cardinal = require('cardinal');
let cliColor = require('cli-color');
const INDENT = " ";
const CODE_START = cliColor.red(`+--------------------`);
const CODE_LINE = cliColor.red(`\n${INDENT}| `);
const CODE_END = cliColor.red(`\n${INDENT}+--------------------\n`);
const LINE_SIZE = process.stdout.columns > 80? 80: process.stdout.columns;
const ALLOWED_TAGS = [
'pre',
'code',
'a',
'i',
'\/p',
'strong',
'blockquote',
'li',
'hr\/'
];
let allowedTags = ALLOWED_TAGS.join('|') + '|\/' + ALLOWED_TAGS.join('|\/');
module.exports = function (str) {