Last active
August 29, 2015 14:10
-
-
Save alazarchuk/8223772181741c4b7a7c to your computer and use it in GitHub Desktop.
Raw Deflate (compress on ruby and decompress on JS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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