Venkat Ramanan
Venkat Ramanan

Reputation: 217

Create an archive .zip from file stream where file mode is Read

There is a zip folder and it contains an XML file. This is been retried from a service as

return File.Open("location", FileMode.Open, FileAccess.Read, FileShare.Read)

Now in the UI, when the user clicks a link, he should get an archive .zip folder and this file should be available in that user's downloaded folder with the XML file.

Currently I am trying using ZipArchiveEntry.ExtractToFile(). It creates a zip folder but when I try to extract it manually, it says empty compressed folder.

Upvotes: 0

Views: 1062

Answers (1)

Prasad Telkikar
Prasad Telkikar

Reputation: 16079

Try with System.IO.Compression library and use ZipFile.ExtractToDirectory(zipPath, ExtractionPath) This might help.

For more help https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-compress-and-extract-files

Upvotes: 0

Related Questions