Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8621751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:53:17+00:00 2026-06-12T06:53:17+00:00

Hy Guys, so after you help me to properly convert the Compress function ,i

  • 0

Hy Guys, so after you help me to properly convert the “Compress” function ,i tryed to convert the Decompress function too

now im here
(decompress function by me)

let DecompressString (detext : string) =
    let buffer = Convert.FromBase64String detext
    using (new MemoryStream ()) <| fun memoryStream ->
            using (new GZipStream(memoryStream, CompressionMode.Decompress, true)) <| fun gzipStream ->
            memoryStream.Position <- 0L
            memoryStream.Read(buffer, 0, Array.length buffer)
            Encoding.UTF8.GetString(buffer)

the original Compressfunction is

let compressString (text : string) =
let buffer = Encoding.UTF8.GetBytes text
using (new MemoryStream ()) <| fun memoryStream ->
    using (new GZipStream(memoryStream, CompressionMode.Compress, true)) <| fun gzipStream ->
        gzipStream.Write (buffer, 0, Array.length buffer)
    memoryStream.Position <- 0L
    let compressedData = Array.zeroCreate (int memoryStream.Length)
    memoryStream.Read (compressedData, 0, compressedData.Length)
    let gzipBuffer = Array.zeroCreate (compressedData.Length + 4)
    Buffer.BlockCopy (compressedData, 0, gzipBuffer, 4, compressedData.Length)
    Buffer.BlockCopy (BitConverter.GetBytes buffer.Length, 0, gzipBuffer, 0, 4)
    Convert.ToBase64String gzipBuffer

if i compress a string like this

File.WriteAllText("test",compressString("bla"))

(I save the file named “test” in this file is the compressed string from “bla”)

“AwAAAB+LCAAAAAAABADtvQdgHEmWJSYvbcp7f0r1StfgdKEIgGATJNiQQBDswYjN5pLsHWlHIymrKoHKZVZlXWYWQMztnbz33nvvvffee++997o7nU4n99//P1xmZAFs9s5K2smeIYCqyB8/fnwfPyImZfb/ADmz70cDAAAA” < seems for me bigger then before? 😀

ok now i try to decompress it again like:

File.WriteAllText("test2",DecompressString(File.ReadAllText("test")))

but in the new “test2” file is only unreadable text like:

“?"&e�ᅮ

so i think my dcompress function dont work properly.

Maybe your my heroes can help me out a second and last time ? 🙂
Anyway thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:53:18+00:00Added an answer on June 12, 2026 at 6:53 am

    Firstly, the memory stream you’re reading from is empty, so nothing will be written to the destination buffer.

    Secondly, you’re re-using buffer and this contains the bytes of the base 64 string argument.

    You can’t get the Length of a GZipStream so you’ll have to copy it to another memory stream:

    let DecompressString (detext : string) =
        let buffer = Convert.FromBase64String detext
        using (new MemoryStream ()) <| fun memoryStream ->
            memoryStream.Write(buffer, 0, Array.length buffer)
            memoryStream.Seek(0L, SeekOrigin.Begin) |> ignore
            using (new GZipStream(memoryStream, CompressionMode.Decompress, true)) <| fun gzipStream ->
                using(new MemoryStream()) <| outStream ->
                    gzipStream.CopyTo(outStream)
                    Encoding.UTF8.GetString(outStream.ToArray())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After an extensive unsuccessful search I hope you guys can help me out here...
After the you guys helped me out so gracefully last time, here is another
Guys, what is function called after my class loaded, where i can call self
Hey guys got a quick question here, how do i set up TweetStream after
Hi guys I was hoping from some help here, please. I have a INSERT
Hi guys I am seeking help in re-writing the image path. Let me explain.....
hy guys, I needed again of the help of you. Now i want to
ok guys need your help again, previously you all introduced me lightbox which after
Hi guys after the help in another post I managed to get the following
Well after getting all the help I could ever hope for, from you guys

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.