How do I read data from a stream to a zip file?
-
-
Xceed admin
-
-
-
Joined on 09-29-2008
-
Longueuil
-
Posts 443
-
-
|
How do I read data from a stream to a zip file?
Yes. The best way to do it would be to create a StreamFile around your stream and call the StreamFile's CopyTo method. For example:
byte[] data = System.Text.Encoding.Default.GetBytes( "This is the data in the sql db" );
using( MemoryStream stream = new MemoryStream( data ) ) { StreamFile file = new StreamFile( stream ); file.Name = "file.ext";
ZipArchive zip = new ZipArchive( new DiskFile( @"d:\test.exe" ) ); zip.BeginUpdate();
XceedSfxPrefix sfx = new XceedSfxPrefix( new DiskFile( @"C:\Program Files\Xceed Components\Xceed Zip Compression Library 5.0\Sfx\xcdsfx32.bin" ) );
zip.SfxPrefix = sfx;
file.CopyTo( zip, true ); zip.EndUpdate(); } |
|
|
|
|
|
|