0

[SOLVED] Code Compression Ratio Calculator

Code Compression Ratio Calculator I'm working on HTML, CSS, JS Minifier tools and I need to calculate the compression ratio depending upon the size of input and output. code. how can I do that. Eg: input size = 20KB output size = 10KB compression: 50% input size = 20KB output size = 20KB compression: 0 input size = 20KB output size = 30KB expansion: 50% https://code.sololearn.com/WL7orjUr68Wu/?ref=app

4th Jan 2021, 4:28 AM
Bibek Oli
Bibek Oli - avatar
1 Antwort
+ 3
The calculation should be adjusted as shown below: From cr = outputSize / inputSize * 100 To cr = (1 - outputSize / inputSize) * 100
4th Jan 2021, 7:46 AM
Brian
Brian - avatar