stats(originalStr, compressedStr)
Provides statistics on compression efficiency.
Parameters:
originalStr– Original string.compressedStr– Compressed string.
Returns: Object with:
originalLength– Length of original string.compressedLength– Length of compressed string.saved– Number of characters saved.percentSaved– Percentage reduction as string.
Example:
1const stats = compressor.stats("hello world hello", "$a $b $a");2console.log(stats);3// { originalLength: 17, compressedLength: 9, saved: 8, percentSaved: '47.06%' }