问题
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 ?
回答1:
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.
来源:https://stackoverflow.com/questions/46601443/how-to-zip-huge-files-in-a-blob-using-stream