Xceed Streaming Compression Library Documentation
Compressing from file to file (VB example)
Examples > Compressing from file to file (VB example)

Here are two examples for compressing from file to file. One for compression, the other for decompression.

Visual Basic - Compression Copy Code

Dim xComp As New XceedStreamingCompression

Call xComp.License( "your license key" ) 

Dim vaBytesRead As Variant 

Set xComp.CompressionFormat = New XceedBZip2CompressionFormat 

On Error Resume Next

Call xComp.ProcessFile("c:\temp\source.txt", 0, 0, cfpCompress, True, _
                       "c:\temp\compressed.cmp", False, vaBytesRead) 

If Err.Number = 0 Then
  Call MsgBox("Compression successful!") 
Else
  Call MsgBox(Err.Description) 
End If

Visual Basic - Decompression Copy Code

Dim xComp As New XceedStreamingCompression

Call xComp.License( "your license key" )

Dim vaBytesRead As Variant 

Set xComp.CompressionFormat = New XceedBZip2CompressionFormat 

On Error Resume Next

Call xComp.ProcessFile("c:\temp\compressed.cmp", 0, 0, cfpDecompress, True, _
                       "c:\temp\decompressed.txt", False, vaBytesRead) 

If Err.Number = 0 Then
  Call MsgBox("Decompression successful!") 
Else
  Call MsgBox(Err.Description) 
End If