login about faq


I'm using the simple in-memory ZIP sample that you provide,and create a simple zip file following the right steps. The resulting ZIP file seems to be invalid.

Here is my sample (.NET Framework 4, 64 bits)

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim zip As New Chilkat.Zip() zip.UnlockComponent("30-day trial")

    ' Get some byte to compress.
    Dim inBytes As Byte()
    inBytes = System.Text.Encoding.ASCII.GetBytes(TextBox1.Text)

    ' Append the data to the in-memory Zip object.
    ' No files are every produced by this example program.
    Dim entry As Chilkat.ZipEntry
    entry = zip.AppendData("inBytes.dat", inBytes)

    ' Get the compressed data.
    Dim compressedBytes As Byte()
    compressedBytes = entry.Copy()

    ' In a real app, the compressed data might be persisted or sent
    ' as part of a message over a connection, perhaps as part of a Web Service RPC.
    Dim fs As System.IO.FileStream
    fs = New System.IO.FileStream("out.zip", System.IO.FileMode.Create)
    fs.Write(compressedBytes, 0, compressedBytes.Length)
End Sub

asked Apr 06 '13 at 01:33

xcv's gravatar image


The Copy method does NOT return the bytes representing the entire Zip archive. It's a method on the ZipEntry object (not the Chilkat.Zip object), and that alone should give a hint. The Copy method returns the compressed bytes for that particular entry as it would exist within the Zip archive. In other words, it's just the compressed bytes of the entry (not the Zip file format with local file headers, central directory headers, etc.).

To get an in-memory image of the zip archive, call Chilkat.Zip.WriteToMemory


answered Apr 06 '13 at 13:51

chilkat's gravatar image

chilkat ♦♦

Thank you very much. It worked!


answered Apr 06 '13 at 15:04

xcv's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Apr 06 '13 at 01:33

Seen: 3,037 times

Last updated: Apr 06 '13 at 15:04

powered by OSQA