3

I'm using Azure with blob storage ans Azure Functions. I got a lot of files and sometimes I want to generate a zip, save it in the storage and generate a link.

As my zip can be big (1 or 2 Go) I would like to do this "on the fly", meaning without using all the memory before save it:

stream on a zipentry
write to the blob
flush the stream
create next zipentry

I know I must use the method PutBlock() in the container, but I'm missing the code between ICSharpZipLib and BlobContainer.

Has someone an idea about it ?

Mescal
  • 123
  • 8
  • This case may be helpful to you:https://stackoverflow.com/questions/18852389/generate-a-zip-file-from-azure-blob-storage-files – Wayne Yang Oct 06 '17 at 08:36
  • Thanks. I'd seen this question, but I was hoping some other technique exists like writing in a zip stream would write a blob stream (don't know if i'm clear with the concept) – Mescal Oct 09 '17 at 07:38

1 Answers1

4

Well, if I look more attentively at the documentation, I would have seen the method

blob.OpenWrite()

which returns a stream :

using (ZipOutputStream zipStream = new ZipOutputStream(blob.OpenWrite()))

Then I did as usual.

Mescal
  • 123
  • 8
  • Are you able to post all the code? Struggling with an implementation at the moment but I'm already using blob write steam as input to zip output stream – lukejkw Dec 08 '22 at 07:44