Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function retrieveArticleImage(article) {
// Verifies that the article parsed via Mercury has a lead image, and tries to fetch it
const imageLoadingSpinner = ora('Descargando y preparando imágen...');
try {
logger('Working on image: %s', article.lead_image_url);
imageLoadingSpinner.start();
// Fetch the image using the "got" package
const response = await got(article.lead_image_url).buffer();
// Prepare the image for displaying it in the terminal
const articleImage = await terminalImage.buffer(response);
imageLoadingSpinner.succeed();
return articleImage;
} catch (err) {
imageLoadingSpinner.warn('No se pudo desplegar la imágen! ' + err.message);
return '';
}
}
(async() => {
console.log(await terminalImage.file('1.png'));
})();
case COPY: {
console.log(`
Image copied to clipboard! 😌`
);
break;
}
default: {
console.log(`
The file can be found here: ${downloadedAs} 😌`
);
if (process.env.TERM_PROGRAM && process.env.TERM_PROGRAM.match('iTerm')) {
console.log(`
iTerm2 should display the image below. 😊
${await terminalImage.file(downloadedAs)}`
);
}
}
}
updateNotifier({pkg}).notify();
process.exit();
} catch (error) {
console.error(`
${red('Error: Sending code to https://carbon.now.sh went wrong.')}
This is mostly due to:
– Insensical input like \`--start 10 --end 2\`
– Carbon being down or taking too long to respond
.split(' ')
.map(x => chalk[randomColor()](x))
.join(' ');
const seedBox = boxen(seed, {
float: 'center',
padding: 1,
borderStyle: 'round',
borderColor: 'yellow',
dimBorder: true
});
if (isIterm) {
termImg(dogeImage, {width: '100%'});
} else {
console.log(await terminalImage.file(dogeImage));
}
console.log(seedBox, '\n\n\n');
})();
(async() => {
console.log(await terminalImage.file('./img/logo.png'))
console.log(`Assistant Relay is now setup and running for${users.map(u => ` ${u}`)} \n`)
console.log(`You can now visit ${global.db.get("baseUrl").value()} in a browser, or send POST requests to it`);
})();
if (!global.db.get("muteStartup").value()) {
async function previewImage(imageData) {
const imageAsJimp = await arrayToJimp(imageData);
const pngBuffer = await imageAsJimp.getBufferAsync(jimp.MIME_PNG);
console.log(await terminalImage.buffer(pngBuffer));
}
const showPreview = async (objName, modelJSON, isDirScan = false) => {
if (objName === true) {
console.log(await terminalImage.buffer(Buffer.from(modelJSON.data)))
} else if (objName && objName !== true && modelJSON.foundObjects.indexOf(objName) == -1 && !isDirScan) {
console.log(`\n'${ objName.substr(0, 1).toUpperCase() + objName.substr(1) }' not found. ` +
`After the --show flag, provide an object name from the list above or 'colormap' to view the highlighted object colormap.`)
} else if (objName && objName !== true && modelJSON.foundObjects.indexOf(objName) == -1 && isDirScan) {
console.log(objName.substr(0, 1).toUpperCase() + objName.substr(1) + ' not found in this image.')
}
else {
console.log(await terminalImage.buffer(Buffer.from(await cropObject(argv.show, modelJSON), 'base64')))
}
if (modelJSON.foundObjects.indexOf(objName) !== -1) {
console.log(modelJSON.fileName)
}
}