SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static string decompressText(string compressedText)
  2.        {
  3.            compressedText = compressedText.Replace("uFEFF", "");
  4.            //compressedText = "CQAAAB+LCAAAAAAABABzzs/LS00uSU0BABaaRpgJAAAA";
  5.            byte[] gzBuffer = Convert.FromBase64String(compressedText);
  6.            using (MemoryStream ms = new MemoryStream())
  7.            {
  8.                int msgLength = BitConverter.ToInt32(gzBuffer, 0);
  9.                ms.Write(gzBuffer, 4, gzBuffer.Length - 4);
  10.  
  11.                byte[] buffer = new byte[msgLength];
  12.                ms.Position = 0;
  13.                using (GZipStream zip = new GZipStream(ms, CompressionMode.Decompress))
  14.                {
  15.                    zip.Read(buffer, 0, buffer.Length);
  16.                }
  17.                return Encoding.UTF8.GetString(buffer);
  18.            }
  19.        }
  20.      
  21. <!DOCTYPE html>
  22. <head>
  23.     <script src="path_to/some_compression_decompression.js"></script>
  24.     <script>
  25.     var text = 'compressedData';
  26.     var libObj = new some_compression_decompression_class();
  27.     console.log(libObj.decompress(text));       // output decompressed data
  28.     </script>
  29. <head>
  30. <body>
  31. </body>
  32. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top