Skip to content

Instantly share code, notes, and snippets.

@alazarchuk
Last active August 29, 2015 14:10
Show Gist options
  • Save alazarchuk/8223772181741c4b7a7c to your computer and use it in GitHub Desktop.
Save alazarchuk/8223772181741c4b7a7c to your computer and use it in GitHub Desktop.
Raw Deflate (compress on ruby and decompress on JS)
require 'base64'
require 'zlib'
// Taken from here http://www.agileweboperations.com/how-inflate-and-deflate-data-ruby-and-php
def gzdeflate (s)
Zlib::Deflate.new(nil, -Zlib::MAX_WBITS).deflate(s, Zlib::FINISH)
end
Base64.encode64(gzdeflate(<data to compress>))
// Implementation is here https://github.com/dankogai/js-deflate
RawDeflate.inflate(atob(<from server>))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment