My recent issue involved the need to decode gzipped data instead of encoding it in gzip format. Since I am executing javascript code outside of a browser environment, I had to figure out how to perform this task using pure javascript.
After some research, I discovered that the JSXGraph library offers a solution for reading gzipped data.
You can access the library and learn more about it from this link:
Moreover, there is a standalone utility called JSXCompressor available, which is licensed under LGPL.
To implement decoding of base64 encoded gzipped data in your project, simply include the jsxcompressor.js file:
<!doctype html>
</head>
<title>Test gzip decompression page</title>
<script src="jsxcompressor.js"></script>
</head>
<body>
<script>
document.write(JXG.decompress('<?php
echo base64_encode(gzencode("Try not. Do, or do not. There is no try."));
?>'));
</script>
</html>
While this may not directly address your original query, I decided to share this information here as I believe it could benefit others facing similar challenges.