Yes, that would possibly be a more advanced way to go - but as written in the initial post the script is sufficient enough for my needs already (which are usecases in the web & browsers are using compression already).
But if you like to improve it feel free to send a PR or just fork it please.
But if you like to improve it feel free to send a PR or just fork it please.