Unzip a single file to local disk or byte arrray or stream.
[Visual Basic] Public Sub ExtractTo( _ z As ZipFile, _ password As String, _ path As String, _ overwrite As Boolean _ ) Public Sub ExtractTo( _ z As ZipFile, _ password As String, _ path As String, _ overwrite As Boolean, _ keepStructure As Boolean _ ) Public Sub ExtractTo( _ z As ZipFile, _ password As String, _ os As Stream _ ) Public Function ExtractTo( _ z As ZipFile, _ password As String _ ) As Byte()
[C#] public void ExtractTo( ZipFile z, string password, string path, bool overwrite ); public void ExtractTo( ZipFile z, string password, string path, bool overwrite, bool keepStructure ); public void ExtractTo( ZipFile z, string password, Stream os ); public byte[] ExtractTo( ZipFile z, string password );
[C++] public: void ExtractTo( ZipFile* z, String* password, String* path, bool overwrite ); public: void ExtractTo( ZipFile* z, String* password, String* path, bool overwrite, bool keepStructure ); public: void ExtractTo( ZipFile* z, String* password, Stream* os ); public: unsigned char __gc[] ExtractTo( ZipFile* z, String* password );
[JScript] public function ExtractTo( z: ZipFile, password: String, path: String, overwrite: Boolean ); public function ExtractTo( z: ZipFile, password: String, path: String, overwrite: Boolean, keepStructure: Boolean ); public function ExtractTo( z: ZipFile, password: String, os: Stream ); public function ExtractTo( z: ZipFile, password: String ): Byte[];
Parameters
Example
[Visual Basic, C#, C++] The following example demonstrates how to compress/decompress file with EACompression Zip Component. This sample doesn't demonstrates the events, please refer to Samples section to get the complete samples of EACompression.
[Visual Basic] Imports EACompression Sub Unzip() Try Dim oZip As New ZipArchive("TryIt") oZip.Load("c:\test.zip") Dim zs() As ZipFile = oZip.Files Dim count As Integer = zs.Length Dim password As String = "" Dim overwrite As Boolean = True For i As Integer = 0 To count - 1 Dim z As ZipFile = zs(i) oZip.ExtractTo(z, password, "c:\unzipped", overwrite) Next Catch ep As Exception Console.Write(ep.Message) End Try End Sub [C#] using System; using System.Collections; using System.IO; using EACompression; void Unzip( ) { try { ZipArchive oZip = new ZipArchive( "TryIt" ); oZip.Load( "c:\\test.zip" ); ZipFile [] zs = oZip.Files; int count = zs.Length; string password = ""; bool overwrite = true; for( int i = 0; i < count; i++ ) { ZipFile z = zs[i]; oZip.ExtractTo( z, password, "c:\\unzipped", overwrite ); } } catch( Exception ep ) { Console.Write( ep.Message ); } } [C++] using namespace System; using namespace System::Collections; using namespace System::IO; using namespace EACompression; void Unzip( ) { try { ZipArchive *oZip = new ZipArchive( S"TryIt" ); oZip->Load( S"c:\\test.zip" ); ZipFile *zs[] = oZip->Files; int count = zs->Length; String *password = S""; bool overwrite = true; for( int i = 0; i < count; i++ ) { ZipFile *z = zs[i]; oZip->ExtractTo( z, password, S"c:\\unzipped", overwrite ); } } catch( Exception *ep ) { Console::Write( ep->Message ); } }
See Also
Handle file overwriting and path structure
Encrypt and decrypt file with password