UNPKG

tinify-client

Version:

A CLI to compress your images not only intelligently but also to the EXTREME!

33 lines (32 loc) 1.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const number_1 = require("../utils/number"); exports.default = { compress: 'Compress', compressing: 'Compressing', compressed: 'Compressed', compressFailed: 'Compressed failed', summarize: ({ dest, beforeSizeInByte, afterSizeInByte, nTurns, lastTurnDelta, costs }) => { const totalBytesOff = beforeSizeInByte - afterSizeInByte; const totalPercentageOff = number_1.getPercentageOff(beforeSizeInByte, afterSizeInByte); return { Where: dest, Before: number_1.toReadableSize(beforeSizeInByte), After: number_1.toReadableSize(afterSizeInByte), Reduced: `${number_1.toReadableSize(totalBytesOff)}, ${totalPercentageOff}`, 'Last Δ': number_1.toReadableSize(lastTurnDelta), Turns: nTurns, 'Costs (ms)': costs, }; // return [ // `${GREEN}${underline(dest)} ${toReadableSize(beforeSizeInByte)}${YELLOW} → ${GREEN}${toReadableSize(afterSizeInByte)} ${EOS}${toReadableSize(totalBytesOff)}, ${green(totalPercentageOff)} off in ${nTurns} turn(s).` // + (lastTurnDelta > 0 ? ` Last turn delta ${toReadableSize(lastTurnDelta)}.` : ''), // `costs:`, // `${cost}ms.`, // ].join(' '); // return `${src} → ${underline(dest)} ${GREEN}${toReadableSize(beforeSizeInByte)}${YELLOW} → ${GREEN}${toReadableSize(afterSizeInByte)} ${EOS}${toReadableSize(totalBytesOff)}, ${totalPercentageOff} off in ${nTurns} turn(s).` + (lastTurnDelta > 0 ? ` Last turn delta ${toReadableSize(lastTurnDelta)}.` : ''); }, genTotalTimeCostsTips({ src = '' } = {}) { return `${this.compress} ${src} total costs`; }, };