Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Create an In-Memory Zip FileCreate an in-memory Zip file. The WriteToMemory method returns a Variant byte array that is an exact image of a Zip file. If the Variant is written to disk a valid Zip file is produced. One may also do other things with the in-memory Zip, such as storing it in a database field, or sending it across a communications channel to another program.
Private Sub Command2_Click()
Dim ZipFile As ChilkatZip2
Dim vByteData As Variant
Set ZipFile = New ChilkatZip2
ZipFile.UnlockComponent "30-day trial"
ZipFile.NewZip "hamlet.zip"
'Add something to our Zip.
success = ZipFile.AppendOneFileOrDir("hamlet.xml", 0)
If (success = 0) Then
MsgBox ZipFile.LastErrorText
Exit Sub
End If
'Write the Zip file into memory.
' (We would normally call WriteZip to write a Zip file, but this
' example is to demonstrate how an image of the Zip can be written
' to memory. One might write a program to Zip to memory and then
' send it over a TCP socket connection, for example.)
vByteData = ZipFile.WriteToMemory()
'Save the byte data to a file.
Open "hamlet.zip" For Binary As #1
Put #1, , vByteData
Close #1
MsgBox "Created Zip!"
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.