Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Self extracting zip from blobs in db

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #19945 |


    I’m trying to make one self extracting zip file from many files stored as blobs in Oracle.
    I want to avoid saving the files to to disk and just stream them into the self extracting zip.

    I’ve looked at examples making use of the self extracting zips.
    I’ve looked at examples using compressed streams.

    But I can’t seam to figure out how to steam the blobs into the self extracting zip.
    I’m thinking I’m trying to do something that is not supported in xceed.

    Is there a solution to this other than saving the files to disk first?

    Imported from legacy forums. Posted by Styrmir (had 1383 views)

    Xceed Support
    Post count: 5658

    Using the ZippedFile class, you can bypass the “on disk” part.

    In this example, let’s say I have a stream on each of the blobs (represented by the stream on each of the files from my TestFolder). Also, my self-extractor file is on disk, but it could be a MemoryFile. As for the name of the file, I gave them random names, but I could have used some file specific names instead. 

    private static void StreamedFilesToSFXForum11600()
      Xceed.Zip.Licenser.LicenseKey = “license key”;
      AbstractFile[] files = new DiskFolder( @”D:\TestFolder” ).GetFiles( true, null );

      AbstractFile sfxFile = new DiskFile( @”D:\Forum11600\archive.exe” );
      ZipArchive archive = new ZipArchive( sfxFile );
      XceedSfxPrefix sfx = new XceedSfxPrefix( new DiskFile( @”C:\Program Files\Xceed Components\Bin\Sfx\XcdSfxZ64AES.bin” ) );
      archive.SfxPrefix = sfx;

      int counter = 0;
      foreach( AbstractFile file in files )
        using( Stream source = file.OpenRead() )
          ZippedFile zipped = new ZippedFile( sfxFile, “Name” + counter.ToString() );
          using( Stream destination = zipped.OpenWrite( true ) )
            byte[] buffer = new byte[ 32768 ];
            int bytesRead = 0;
            while( ( bytesRead = source.Read( buffer, 0, buffer.Length ) ) > 0 )
              destination.Write( buffer, 0, bytesRead );

    Imported from legacy forums. Posted by CharlesB (had 1486 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.