Reputation: 137
I need to create a WCF method that accept a bytes array of the zip file contains the multiple pdf files and create the Zip files from the input bytes and save it in any folder of my application.
I am using WCf application.
Can any one help me ...
Thanks
Upvotes: 0
Views: 673
Reputation: 5746
What do you really want to do here? You write that you want to get a Zip file from service and save it to disk (basicly: get a file through wcf service). Probably you want the contents of the zipfile instead?
For this you need a library to handle zip files, I suggest DotNetZip. To my knowledge DotNetZip can load from File and Stream as well as byte arrays. If not, you could create a stream from the byte array and pass that into the zip library.
Stream stream = new MemoryStream(byteArray);
For extracting and other operations, please read the manual on whichever zip library you choose.
Should you really just want to save a file from your byte array:
File.WriteAllBytes(string path, byte[] byteArray);
Either way, as @Alexander Stepaniuk suggests, you might be better off using a stream in your service, rather than passing byte arrays, read his post and links too.
Upvotes: 0
Reputation: 6408
I'd suggest the following:
Stream
to WCF method rather than as a byte array. See Large Data and Streaming for details.Stream
. E.g. SharpZipLib can.Upvotes: 1