apppublic/test/brotli_test.py
2021-07-13 16:14:20 +08:00

14 lines
235 B
Python

import sys
from brotli import compress, decompress
def do(fn):
with open(fn, 'rb') as f:
b = f.read()
c = compress(b)
d = decompress(c)
print(fn,'\t',
float(len(c))/float(len(b)))
fns = sys.argv[1:]
for fn in fns:
do(fn)