User (Old forums)MemberMarch 12, 2008 at 3:48 amPost count: 23064
this is the scenario:
I need to compress a file using real time zip.
While the file is getting compressed, i want to start writing the contents to a file or upload the stream to an ftp.
Can i achieve this using real time zip?
This is what i am doing at present:-
1. Compressing the file as provided in the samples.
2. Inside zipWriter.ByteProgression i am using the compressed memory stream,to do write operation or the ftp upload. the ftp upload function accepts a stream to upload.
so every time a block is compressed to the compressedStream, the zipWriter.ByteProgression is raised and this is where, writing to a file or upload will be done.
but, everytime the event is raised i jus get the length of compressed memory stream as “42” which probably is the size of the header.
What am i doing wrong?
Any suggestions sample would be appreciated.
Imported from legacy forums. Posted by Harpreet (had 3351 views)Xceed SupportMemberMarch 12, 2008 at 7:55 amPost count: 5658
You can use an FtpFile and call OpenWrite on it to obtain a writable stream to this remote file. This stream can be passed to the ZipWriter constructor and everything you write into the ZipWriter will be directly uploaded to the specified FtpFile:
string hostname = “ftpserver”;
int port = 21;
string user = “user”;
string pass = “pass”;
using( FtpConnection connection = new FtpConnection( hostname, port, user, pass ) )
AbstractFile ftpZipFile = new FtpFile( connection, “FtpZipArchive.zip” );
using( Stream uploadStream = ftpZipFile.OpenWrite( true ) )
using( ZipWriter writer = new ZipWriter( uploadStream ) )
// Write bytes directly into the ZipWriter, those bytes
// will be directly uploaded to the Ftp server
Imported from legacy forums. Posted by Chris [Xceed] (had 376 views)User (Old forums)MemberMarch 12, 2008 at 9:21 amPost count: 23064
thanks for the reply.
I will check it out.
One more question:
How can i achieve the following:
I want to start writing the compressed stream to a file on my hard disk, as soon as the compression is started.
I want to do this, so that i dont have to wait for the entire compression to finish and then start writing to a file.
I want to gain that extra performance edge through your component.
Can i do it?
Any help or code sample would be appreciated.
Imported from legacy forums. Posted by Harpreet (had 305 views)
- You must be logged in to reply to this topic.