I've run into a bit of an issue with gzip compression.
Say we compress the letter 'a' with pako library in javascript, as follows:
pako.gzip('a')
This returns the following byte array:
[31,139,8,0,0,0,0,0,0,3,75,4,0,67,190,183,232,1,0,0,0]
Now, if I take this array and decompress it in python, I get the result as expected:
import gzip
arr_from_pako = bytearray([31,139,8,0,0,0,0,0,0,3,75,4,0,67,190,183,232,1,0,0,0])
decompressed = gzip.decompress(arr_from_pako)
print(decompressed)
>>> b'a'
However, if I then reverse the process and gzip compress the result in python, I get a different bytearray:
arr_from_python = list(gzip.compress(decompressed))
print(arr_from_python)
>>> [31, 139, 8, 0, 123, 15, 138, 98, 2, 255, 75, 4, 0, 67, 190, 183, 232, 1, 0, 0, 0]
What I need to do here is reproduce the result of pako.gzip in python. I'm guessing the differences are due to a compression level and I know gzip lib in python lets you adjust it but I tried every single setting and was not able to get the expected result.
Can anyone help?