Skip to content

Instantly share code, notes, and snippets.

@robmint
Created February 11, 2016 00:53
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 robmint/3ee21f982b1771aaff2f to your computer and use it in GitHub Desktop.
Save robmint/3ee21f982b1771aaff2f to your computer and use it in GitHub Desktop.
Huffman compression of URLs in node.js
// just a test to see if compressing url-encoded json looks/works any better
var strofa = require("strofa");
cl = function(obj) { console.dir(obj, {depth: null, colors: true}); };
var string = '{"subjectonly_keyword":["ACCTG 713"]}';
cl(string);
cl(encodeURIComponent(string));
var output = strofa.english.encodeBase64(string);
cl(output);
cl(strofa.english.decodeBase64(output));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment