Welcome to the Xceed Community | Help
Community Search  

Real time zip file creation

Sort Posts: Previous Next
  •  10-17-2008, 11:51 AM Post no. 16200

    Real time zip file creation

    Hi,

    I wrote a piece of sw that is getting data from a device.
    I'm storing the data in binary files in a specific folder. Each 5MB, I create a new binary.

    For the moment, I filling this directory, and when I stop getting data, I launch zip process that takes all binary files one by one and copy them in the archive.

    My concern is it's taking too much time (I need to zip 500-600 files of 5MB). What I do:

    archive.BeginUpdate();
    foreach (AbstractFile file in sourceFolder.GetFiles(true, null))
    {
        i++;
        MainForm.SetStatusMessage("Closing ZIP... (Archiving " + i + " of " + nbOfFiles.ToString() + ")");
        file.CopyTo(archive, true);
    }
    archive.EndUpdate();

     
    where archive is a ZipArchive object.

     
    I would like to improve my algorithm starting the sippage while getting data:

    Each time I receive a binary, I do :

    archive.BeginUpdate();
    DiskFile file = new DiskFile(pFileName);
    file.CopyTo(archive, true);
    archive.EndUpdate();

    It's good for the first 20 binary files, but when we reach the 100th file, the copy to the archive is taking to much cpu and time.

    How can I do with Xceed component to generate this ZIP file in real time ?


    Thanks

    Ben 

    Filed under:
  •  10-17-2008, 2:24 PM Post no. 16208 in reply to 16200

    Re: Real time zip file creation

    If you do not need to manipulate the archive in between adding new files until the whole archive is constructed, then you should use Real-Time Zip for .NET.  It will zip your stream as it is coming it.

    e.g.:

    ZipWriter( Stream outputStream )

    WriteLocalHeader, WriteData

      WeiteLocalHeader, WriteData

       ...( for each file)

    ZipWriter.Close()

    You can read more in the documentation on how to use this :

    http://doc.xceedsoft.com/products/XceedRTZip/Introduction.html

     


    André
    Software Developer and Tech Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.