Sometimes, we need to have posts that can bypass the 30,000 character limit. I have created this Stack Snippet that, given text as input, compresses the text and outputs a Stack Snippet that can be run to view the original text.

var fmt = pako.inflate(atob("eJx1kcFugzAMhu99Co9NAqSRqDsyyrsYcNOwkGSx0TpVffdBO7TL6pP/39Zn2W6eqgo6MtYDexsjSQ0jw8kOVIOkmaAPnoNb1BEdE3TYkdtEVbW7XbMiHHozo1na1qxaELcaLPFSZM+YlUroLEXEj6CsPzoUKlBCV+SXa16+wkVCDTlLst7k17J8/x98ksn9oRvuk40CnPpDdhKJXGvdD14l/DJWVB8m7cNAPep1sJ6QhZIeLMvNUJP1auSsbfSd1D7G4ohnZUIwjjBavrFXTzvbsR4/Z0rf+k3t1f5XPILHRGCHQ4bZ3QC4+3opbOckP2z/WLf9ATMjg/g="), {
  to: 'string'
$('#compress').click(function() {
  $('#output').val(fmt.replace(/{}/, btoa(pako.deflate($('#input').val(), {
    to: 'string'
<script src="https://cdn.rawgit.com/nodeca/pako/master/dist/pako.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea id="input"></textarea>
<input type="button" value="Compress" id="compress" />
<textarea id="output" readonly></textarea>

An example output Stack Snippet:

$("#a").text(pako.inflate(atob('eJzzSM3JyddRCM8vyklRBAAfngRq'), {to: 'string'}));
<script src="https://cdn.rawgit.com/nodeca/pako/master/dist/pako.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<pre id="a">

Alternatively, if the above solution is still too long, you can save the contents to a public GitHub Gist, and display it with the following snippet (replacing the URL with your Gist's URL):

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="a">

Feedback is always appreciated.

  • 2
    \$\begingroup\$ Is jQuery really necessary for this? \$\endgroup\$ – programmer5000 May 2 '17 at 10:16
  • \$\begingroup\$ @programmer5000 No, but it saves bytes. \$\endgroup\$ – Mego May 2 '17 at 10:18
  • \$\begingroup\$ including the code required to load it? \$\endgroup\$ – programmer5000 May 2 '17 at 10:18
  • 1
    \$\begingroup\$ @programmer5000 It seems I counted wrong. It's barely longer with jQuery. But, jQuery is simple and ubiquitous, and I'm much more experienced with it than with vanilla DOM manipulation, so I chose to use it. \$\endgroup\$ – Mego May 2 '17 at 10:25

You must log in to answer this question.

Browse other questions tagged .