Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Created September 13, 2022 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hermann-SW/994749bd17af1905f806e2bbd5ab5b45 to your computer and use it in GitHub Desktop.
Save Hermann-SW/994749bd17af1905f806e2bbd5ab5b45 to your computer and use it in GitHub Desktop.
"zcat C30.txt.gz" in browser JavaScript
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript" src="pako.js"></script>
<script>
function reqListener () {
var originalInput = pako.ungzip(this.response,{ to: 'string' });
document.write("<pre>"+originalInput+"</pre>");
}
const req = new XMLHttpRequest();
req.addEventListener("load", reqListener);
req.open("GET", "C30.txt.gz");
req.responseType = "arraybuffer";
req.send();
</script>
</body>
</html>
@Hermann-SW
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment