Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET How do I read data from a stream to a zip file?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20589 |

    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();
    }

    Imported from legacy forums. Posted by Xceed admin (had 2205 views)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.