function exit() { if (process.stdout.isTTY) { logUpdate(`${lineBreak(2)}${spacing(4)}${speed()}`); } else { let output = `${data.downloadSpeed} ${data.downloadUnit}`; if (cli.flags.upload) { output += `\n${data.uploadSpeed} ${data.uploadUnit}`; } console.log(output); } process.exit(); }
(async () => { try { await api({measureUpload: cli.flags.upload}).forEach(result => { data = result; }); exit(); } catch (error) { console.error(error.message); process.exit(1); } })();
const speedText = () => cli.flags.upload ? `${downloadColor(downloadSpeed())} ${chalk.dim('/')} ${uploadColor(uploadSpeed())}` : downloadColor(downloadSpeed())