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
1 Réponse
+ 3
The calculation should be adjusted as shown below:
From
cr = outputSize / inputSize * 100
To
cr = (1 - outputSize / inputSize) * 100