From 8bf2990f2513d85bdf51ebee7925b5d6bddd4a26 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 8 Oct 2025 13:37:30 +0200 Subject: [PATCH 1/6] simplify test running --- .github/workflows/test.yml | 3 --- package.json | 19 +++++++++-------- utils/compress.mjs | 43 +++++++++++++++++++++++--------------- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d3f7033..e3014f87 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,9 +39,6 @@ jobs: - name: Install Node Packages run: npm ci - - name: Decompress compressed files - run: npm run decompress - - name: Cache jsvu Binaries uses: actions/cache@v4 with: diff --git a/package.json b/package.json index 689f6ce9..7b348193 100644 --- a/package.json +++ b/package.json @@ -17,19 +17,20 @@ "scripts": { "server": "node tests/server.mjs", "compress": "node utils/compress.mjs", - "decompress": "node utils/compress.mjs -d -k", + "decompress": "node utils/compress.mjs --decompress --keep ", "lint:check": "eslint **/*.{js,mjs,jsx,ts,tsx}", "pretty:check": "prettier --check ./", "pretty:format": "prettier --write ./", "format:check": "npm run pretty:check && npm run lint:check", - "test:chrome": "node tests/run-browser.mjs --browser chrome", - "test:firefox": "node tests/run-browser.mjs --browser firefox", - "test:safari": "node tests/run-browser.mjs --browser safari", - "test:edge": "node tests/run-browser.mjs --browser edge", - "test:shell": "npm run test:v8 && npm run test:jsc && npm run test:spidermonkey", - "test:v8": "node tests/run-shell.mjs --shell v8", - "test:jsc": "node tests/run-shell.mjs --shell jsc", - "test:spidermonkey": "node tests/run-shell.mjs --shell spidermonkey" + "test:prepare": "npm run decompress -- --quiet", + "test:chrome": "npm run test:prepare && node tests/run-browser.mjs --browser chrome", + "test:firefox": "npm run test:prepare && node tests/run-browser.mjs --browser firefox", + "test:safari": "npm run test:prepare && node tests/run-browser.mjs --browser safari", + "test:edge": "npm run test:prepare && node tests/run-browser.mjs --browser edge", + "test:shell": "npm run test:prepare && npm run test:v8 && npm run test:jsc && npm run test:spidermonkey", + "test:v8": "npm run test:prepare && node tests/run-shell.mjs --shell v8", + "test:jsc": "npm run test:prepare && node tests/run-shell.mjs --shell jsc", + "test:spidermonkey": "npm run test:prepare && node tests/run-shell.mjs --shell spidermonkey" }, "devDependencies": { "@actions/core": "^1.11.1", diff --git a/utils/compress.mjs b/utils/compress.mjs index fb91d7bc..72d52f2e 100644 --- a/utils/compress.mjs +++ b/utils/compress.mjs @@ -5,11 +5,15 @@ import zlib from 'zlib'; import fs from 'fs'; import path from 'path'; + +let log = console.log + function parseCommandLineArgs() { const optionDefinitions = [ { name: 'decompress', alias: 'd', type: Boolean, description: 'Decompress files (default: compress).' }, { name: 'keep', alias: 'k', type: Boolean, description: 'Keep input files after processing (default: delete).' }, { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide.' }, + { name: 'quiet', alias: 'q', type: Boolean, description: 'Print this usage guide.' }, { name: 'globs', type: String, multiple: true, defaultOption: true, description: 'Glob patterns of files to process.' }, ]; const options = commandLineArgs(optionDefinitions); @@ -32,10 +36,14 @@ function parseCommandLineArgs() { process.exit(0); } + if (options.quiet) { + log = () => {}; + } + if (options.globs === undefined) { if (options.decompress) { const defaultGlob = '**/*.z'; - console.log(`No input glob pattern given, using default: ${defaultGlob}`); + log(`No input glob pattern given, using default: ${defaultGlob}`); options.globs = [defaultGlob]; } else { // For compression, require the user to specify explicit input file patterns. @@ -44,6 +52,7 @@ function parseCommandLineArgs() { process.exit(1); } } + return options; } @@ -61,9 +70,9 @@ function compress(inputData) { const originalSize = inputData.length; const compressedSize = compressedData.length; const compressionRatio = calculateCompressionRatio(originalSize, compressedSize); - console.log(` Original size: ${String(originalSize).padStart(8)} bytes`); - console.log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); - console.log(` Compression ratio: ${compressionRatio.toFixed(2).padStart(8)}%`); + log(` Original size: ${String(originalSize).padStart(8)} bytes`); + log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); + log(` Compression ratio: ${compressionRatio.toFixed(2).padStart(8)}%`); return compressedData; } @@ -74,9 +83,9 @@ function decompress(inputData) { const compressedSize = inputData.length; const decompressedSize = decompressedData.length; const expansionRatio = calculateExpansionRatio(compressedSize, decompressedSize); - console.log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); - console.log(` Decompressed size: ${String(decompressedSize).padStart(8)} bytes`); - console.log(` Expansion ratio: ${expansionRatio.toFixed(2).padStart(8)}%`); + log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); + log(` Decompressed size: ${String(decompressedSize).padStart(8)} bytes`); + log(` Expansion ratio: ${expansionRatio.toFixed(2).padStart(8)}%`); return decompressedData; } @@ -94,7 +103,7 @@ function globsToFiles(globs) { function processFiles(files, isDecompress, keep) { const verb = isDecompress ? 'decompress' : 'compress'; - console.log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); + log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); // For printing overall statistics at the end. let totalInputSize = 0; @@ -102,7 +111,7 @@ function processFiles(files, isDecompress, keep) { for (const inputFilename of files) { try { - console.log(inputFilename); + log(inputFilename); let outputFilename; if (isDecompress) { if (path.extname(inputFilename) !== '.z') { @@ -111,7 +120,7 @@ function processFiles(files, isDecompress, keep) { } else { outputFilename = inputFilename.slice(0, -2); } - console.log(` Decompressing to: ${outputFilename}`); + log(` Decompressing to: ${outputFilename}`); } else { if (path.extname(inputFilename) === '.z') { console.warn(` Warning: Input file already has a .z extension.`); @@ -130,7 +139,7 @@ function processFiles(files, isDecompress, keep) { if (!keep) { fs.unlinkSync(inputFilename); - console.log(` Deleted input file.`); + log(` Deleted input file.`); } } catch (err) { console.error(`Error ${verb}ing ${inputFilename}:`, err); @@ -140,14 +149,14 @@ function processFiles(files, isDecompress, keep) { if (files.length > 1) { if (isDecompress) { const totalExpansionRatio = calculateExpansionRatio(totalInputSize, totalOutputSize); - console.log(`Total compressed sizes: ${String(totalInputSize).padStart(9)} bytes`); - console.log(`Total decompressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); - console.log(`Average expansion ratio: ${totalExpansionRatio.toFixed(2).padStart(9)}%`); + log(`Total compressed sizes: ${String(totalInputSize).padStart(9)} bytes`); + log(`Total decompressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); + log(`Average expansion ratio: ${totalExpansionRatio.toFixed(2).padStart(9)}%`); } else { const totalCompressionRatio = calculateCompressionRatio(totalInputSize, totalOutputSize); - console.log(`Total original sizes: ${String(totalInputSize).padStart(9)} bytes`); - console.log(`Total compressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); - console.log(`Average compression ratio: ${totalCompressionRatio.toFixed(2).padStart(9)}%`); + log(`Total original sizes: ${String(totalInputSize).padStart(9)} bytes`); + log(`Total compressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); + log(`Average compression ratio: ${totalCompressionRatio.toFixed(2).padStart(9)}%`); } } } From 15091d19fa102da749282912feea9b03dd6e99d8 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 8 Oct 2025 13:49:11 +0200 Subject: [PATCH 2/6] make-async --- utils/compress.mjs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/utils/compress.mjs b/utils/compress.mjs index 72d52f2e..110f3438 100644 --- a/utils/compress.mjs +++ b/utils/compress.mjs @@ -1,6 +1,6 @@ import commandLineArgs from 'command-line-args'; import commandLineUsage from 'command-line-usage'; -import { globSync } from 'glob'; +import { globSync, globIterate } from 'glob'; import zlib from 'zlib'; import fs from 'fs'; import path from 'path'; @@ -90,26 +90,29 @@ function decompress(inputData) { return decompressedData; } -function globsToFiles(globs) { - let files = []; +async function* globsToFiles(globs) { + let files = new Set(); console.assert(globs.length > 0); for (const glob of globs) { - const matches = globSync(glob, { nodir: true }); - files = files.concat(matches); + for await (const file of globIterate(glob, { nodir: true })) { + if (files.has(file)) + continue; + files.add(file) + yield file; + } } - files = Array.from(new Set(files)).sort(); - return files; } -function processFiles(files, isDecompress, keep) { +async function processFiles(filesGenerator, isDecompress, keep) { const verb = isDecompress ? 'decompress' : 'compress'; - log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); + const files = []; // For printing overall statistics at the end. let totalInputSize = 0; let totalOutputSize = 0; - for (const inputFilename of files) { + for await (const inputFilename of filesGenerator) { + files.push(inputFilename); try { log(inputFilename); let outputFilename; @@ -147,6 +150,7 @@ function processFiles(files, isDecompress, keep) { } if (files.length > 1) { + log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); if (isDecompress) { const totalExpansionRatio = calculateExpansionRatio(totalInputSize, totalOutputSize); log(`Total compressed sizes: ${String(totalInputSize).padStart(9)} bytes`); From 0672ec47323a3d2fa14f262e603f98fcbb527630 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 8 Oct 2025 13:55:10 +0200 Subject: [PATCH 3/6] ignore --- utils/compress.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/compress.mjs b/utils/compress.mjs index 110f3438..9f74b8d8 100644 --- a/utils/compress.mjs +++ b/utils/compress.mjs @@ -93,8 +93,9 @@ function decompress(inputData) { async function* globsToFiles(globs) { let files = new Set(); console.assert(globs.length > 0); + const globtions = { nodir: true, ignore: '**/node_modules/**' }; for (const glob of globs) { - for await (const file of globIterate(glob, { nodir: true })) { + for await (const file of globIterate(glob, globtions)) { if (files.has(file)) continue; files.add(file) From 30b12f0952bb1e300df617e1cc0271a3b23f7bc7 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Wed, 8 Oct 2025 16:39:01 +0200 Subject: [PATCH 4/6] update flag description --- utils/compress.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/compress.mjs b/utils/compress.mjs index 9f74b8d8..d2385e0f 100644 --- a/utils/compress.mjs +++ b/utils/compress.mjs @@ -13,7 +13,7 @@ function parseCommandLineArgs() { { name: 'decompress', alias: 'd', type: Boolean, description: 'Decompress files (default: compress).' }, { name: 'keep', alias: 'k', type: Boolean, description: 'Keep input files after processing (default: delete).' }, { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide.' }, - { name: 'quiet', alias: 'q', type: Boolean, description: 'Print this usage guide.' }, + { name: 'quiet', alias: 'q', type: Boolean, description: 'Quite output, only print errors.' }, { name: 'globs', type: String, multiple: true, defaultOption: true, description: 'Glob patterns of files to process.' }, ]; const options = commandLineArgs(optionDefinitions); From a638f5d620deb6ca9b9ab8988bb09eebd3a8fdc9 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Fri, 17 Oct 2025 15:42:22 +0200 Subject: [PATCH 5/6] partial revert --- utils/compress.mjs | 67 +++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/utils/compress.mjs b/utils/compress.mjs index d2385e0f..54e1b320 100644 --- a/utils/compress.mjs +++ b/utils/compress.mjs @@ -1,19 +1,15 @@ import commandLineArgs from 'command-line-args'; import commandLineUsage from 'command-line-usage'; -import { globSync, globIterate } from 'glob'; +import { globSync } from 'glob'; import zlib from 'zlib'; import fs from 'fs'; import path from 'path'; - -let log = console.log - function parseCommandLineArgs() { const optionDefinitions = [ { name: 'decompress', alias: 'd', type: Boolean, description: 'Decompress files (default: compress).' }, { name: 'keep', alias: 'k', type: Boolean, description: 'Keep input files after processing (default: delete).' }, { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide.' }, - { name: 'quiet', alias: 'q', type: Boolean, description: 'Quite output, only print errors.' }, { name: 'globs', type: String, multiple: true, defaultOption: true, description: 'Glob patterns of files to process.' }, ]; const options = commandLineArgs(optionDefinitions); @@ -36,14 +32,10 @@ function parseCommandLineArgs() { process.exit(0); } - if (options.quiet) { - log = () => {}; - } - if (options.globs === undefined) { if (options.decompress) { const defaultGlob = '**/*.z'; - log(`No input glob pattern given, using default: ${defaultGlob}`); + console.log(`No input glob pattern given, using default: ${defaultGlob}`); options.globs = [defaultGlob]; } else { // For compression, require the user to specify explicit input file patterns. @@ -52,7 +44,6 @@ function parseCommandLineArgs() { process.exit(1); } } - return options; } @@ -70,9 +61,9 @@ function compress(inputData) { const originalSize = inputData.length; const compressedSize = compressedData.length; const compressionRatio = calculateCompressionRatio(originalSize, compressedSize); - log(` Original size: ${String(originalSize).padStart(8)} bytes`); - log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); - log(` Compression ratio: ${compressionRatio.toFixed(2).padStart(8)}%`); + console.log(` Original size: ${String(originalSize).padStart(8)} bytes`); + console.log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); + console.log(` Compression ratio: ${compressionRatio.toFixed(2).padStart(8)}%`); return compressedData; } @@ -83,39 +74,36 @@ function decompress(inputData) { const compressedSize = inputData.length; const decompressedSize = decompressedData.length; const expansionRatio = calculateExpansionRatio(compressedSize, decompressedSize); - log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); - log(` Decompressed size: ${String(decompressedSize).padStart(8)} bytes`); - log(` Expansion ratio: ${expansionRatio.toFixed(2).padStart(8)}%`); + console.log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); + console.log(` Decompressed size: ${String(decompressedSize).padStart(8)} bytes`); + console.log(` Expansion ratio: ${expansionRatio.toFixed(2).padStart(8)}%`); return decompressedData; } -async function* globsToFiles(globs) { - let files = new Set(); - console.assert(globs.length > 0); +function globsToFiles(globs) { + let files = []; + console.assert(globs.length > 0) ; const globtions = { nodir: true, ignore: '**/node_modules/**' }; for (const glob of globs) { - for await (const file of globIterate(glob, globtions)) { - if (files.has(file)) - continue; - files.add(file) - yield file; - } + const matches = globSync(glob, globtions); + files = files.concat(matches); } + files = Array.from(new Set(files)).sort(); + return files; } -async function processFiles(filesGenerator, isDecompress, keep) { +function processFiles(files, isDecompress, keep) { const verb = isDecompress ? 'decompress' : 'compress'; - const files = []; + console.log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); // For printing overall statistics at the end. let totalInputSize = 0; let totalOutputSize = 0; - for await (const inputFilename of filesGenerator) { - files.push(inputFilename); + for (const inputFilename of files) { try { - log(inputFilename); + console.log(inputFilename); let outputFilename; if (isDecompress) { if (path.extname(inputFilename) !== '.z') { @@ -124,7 +112,7 @@ async function processFiles(filesGenerator, isDecompress, keep) { } else { outputFilename = inputFilename.slice(0, -2); } - log(` Decompressing to: ${outputFilename}`); + console.log(` Decompressing to: ${outputFilename}`); } else { if (path.extname(inputFilename) === '.z') { console.warn(` Warning: Input file already has a .z extension.`); @@ -143,7 +131,7 @@ async function processFiles(filesGenerator, isDecompress, keep) { if (!keep) { fs.unlinkSync(inputFilename); - log(` Deleted input file.`); + console.log(` Deleted input file.`); } } catch (err) { console.error(`Error ${verb}ing ${inputFilename}:`, err); @@ -151,17 +139,16 @@ async function processFiles(filesGenerator, isDecompress, keep) { } if (files.length > 1) { - log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); if (isDecompress) { const totalExpansionRatio = calculateExpansionRatio(totalInputSize, totalOutputSize); - log(`Total compressed sizes: ${String(totalInputSize).padStart(9)} bytes`); - log(`Total decompressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); - log(`Average expansion ratio: ${totalExpansionRatio.toFixed(2).padStart(9)}%`); + console.log(`Total compressed sizes: ${String(totalInputSize).padStart(9)} bytes`); + console.log(`Total decompressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); + console.log(`Average expansion ratio: ${totalExpansionRatio.toFixed(2).padStart(9)}%`); } else { const totalCompressionRatio = calculateCompressionRatio(totalInputSize, totalOutputSize); - log(`Total original sizes: ${String(totalInputSize).padStart(9)} bytes`); - log(`Total compressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); - log(`Average compression ratio: ${totalCompressionRatio.toFixed(2).padStart(9)}%`); + console.log(`Total original sizes: ${String(totalInputSize).padStart(9)} bytes`); + console.log(`Total compressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); + console.log(`Average compression ratio: ${totalCompressionRatio.toFixed(2).padStart(9)}%`); } } } From afe463a37205d77d4e8f42ca539842a2ae7963e4 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Fri, 17 Oct 2025 15:44:11 +0200 Subject: [PATCH 6/6] partial revert --- utils/compress.mjs | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/utils/compress.mjs b/utils/compress.mjs index 54e1b320..4e5c5cc6 100644 --- a/utils/compress.mjs +++ b/utils/compress.mjs @@ -5,11 +5,14 @@ import zlib from 'zlib'; import fs from 'fs'; import path from 'path'; +let log = console.log + function parseCommandLineArgs() { const optionDefinitions = [ { name: 'decompress', alias: 'd', type: Boolean, description: 'Decompress files (default: compress).' }, { name: 'keep', alias: 'k', type: Boolean, description: 'Keep input files after processing (default: delete).' }, { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide.' }, + { name: 'quiet', alias: 'q', type: Boolean, description: 'Quite output, only print errors.' }, { name: 'globs', type: String, multiple: true, defaultOption: true, description: 'Glob patterns of files to process.' }, ]; const options = commandLineArgs(optionDefinitions); @@ -32,10 +35,14 @@ function parseCommandLineArgs() { process.exit(0); } + if (options.quiet) { + log = () => {}; + } + if (options.globs === undefined) { if (options.decompress) { const defaultGlob = '**/*.z'; - console.log(`No input glob pattern given, using default: ${defaultGlob}`); + log(`No input glob pattern given, using default: ${defaultGlob}`); options.globs = [defaultGlob]; } else { // For compression, require the user to specify explicit input file patterns. @@ -61,9 +68,9 @@ function compress(inputData) { const originalSize = inputData.length; const compressedSize = compressedData.length; const compressionRatio = calculateCompressionRatio(originalSize, compressedSize); - console.log(` Original size: ${String(originalSize).padStart(8)} bytes`); - console.log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); - console.log(` Compression ratio: ${compressionRatio.toFixed(2).padStart(8)}%`); + log(` Original size: ${String(originalSize).padStart(8)} bytes`); + log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); + log(` Compression ratio: ${compressionRatio.toFixed(2).padStart(8)}%`); return compressedData; } @@ -74,9 +81,9 @@ function decompress(inputData) { const compressedSize = inputData.length; const decompressedSize = decompressedData.length; const expansionRatio = calculateExpansionRatio(compressedSize, decompressedSize); - console.log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); - console.log(` Decompressed size: ${String(decompressedSize).padStart(8)} bytes`); - console.log(` Expansion ratio: ${expansionRatio.toFixed(2).padStart(8)}%`); + log(` Compressed size: ${String(compressedSize).padStart(8)} bytes`); + log(` Decompressed size: ${String(decompressedSize).padStart(8)} bytes`); + log(` Expansion ratio: ${expansionRatio.toFixed(2).padStart(8)}%`); return decompressedData; } @@ -95,7 +102,7 @@ function globsToFiles(globs) { function processFiles(files, isDecompress, keep) { const verb = isDecompress ? 'decompress' : 'compress'; - console.log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); + log(`Found ${files.length} files to ${verb}` + (files.length ? ':' : '.')); // For printing overall statistics at the end. let totalInputSize = 0; @@ -112,7 +119,7 @@ function processFiles(files, isDecompress, keep) { } else { outputFilename = inputFilename.slice(0, -2); } - console.log(` Decompressing to: ${outputFilename}`); + log(` Decompressing to: ${outputFilename}`); } else { if (path.extname(inputFilename) === '.z') { console.warn(` Warning: Input file already has a .z extension.`); @@ -131,7 +138,7 @@ function processFiles(files, isDecompress, keep) { if (!keep) { fs.unlinkSync(inputFilename); - console.log(` Deleted input file.`); + log(` Deleted input file.`); } } catch (err) { console.error(`Error ${verb}ing ${inputFilename}:`, err); @@ -141,14 +148,14 @@ function processFiles(files, isDecompress, keep) { if (files.length > 1) { if (isDecompress) { const totalExpansionRatio = calculateExpansionRatio(totalInputSize, totalOutputSize); - console.log(`Total compressed sizes: ${String(totalInputSize).padStart(9)} bytes`); - console.log(`Total decompressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); - console.log(`Average expansion ratio: ${totalExpansionRatio.toFixed(2).padStart(9)}%`); + log(`Total compressed sizes: ${String(totalInputSize).padStart(9)} bytes`); + log(`Total decompressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); + log(`Average expansion ratio: ${totalExpansionRatio.toFixed(2).padStart(9)}%`); } else { const totalCompressionRatio = calculateCompressionRatio(totalInputSize, totalOutputSize); - console.log(`Total original sizes: ${String(totalInputSize).padStart(9)} bytes`); - console.log(`Total compressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); - console.log(`Average compression ratio: ${totalCompressionRatio.toFixed(2).padStart(9)}%`); + log(`Total original sizes: ${String(totalInputSize).padStart(9)} bytes`); + log(`Total compressed sizes: ${String(totalOutputSize).padStart(9)} bytes`); + log(`Average compression ratio: ${totalCompressionRatio.toFixed(2).padStart(9)}%`); } } }