Append files to a zip inside azure storage container

Mani 0 Reputation points
2023-11-16T21:27:01.2433333+00:00

I have a requirement to write multiple files into azure blob as a zip, files may come any time of the day. I need to append new files to the existing zip file inside the blob.

One option I explored is downloading the existing zip, decompressing, and then compressing with the new file but I feel this is not an ideal scenario.

Is there an option in Azure where we can write files to the same zip without having to download it.

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,966 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,065 Reputation points MVP
    2023-11-16T22:24:05.1533333+00:00

    Appending files directly to an existing ZIP file stored in an Azure Blob Storage container isn't natively supported by Azure Blob Storage.

    Alternative approaches

    https://josef.codes/azure-storage-zip-multiple-files-using-azure-functions/

    • Azure Blob Storage supports append blobs, which are designed for append operations. While this doesn't directly allow appending to a ZIP file, it does provide a way to append data to a blob. Append blobs are similar to block blobs but are optimized for append operations, making them suitable for scenarios like logging data. However, this method would require a different approach to file storage and management, as it doesn't work with ZIP files directly

    https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-append#:~:text=You%20can%20append%20data%20to,logging%20data%20from%20virtual%20machines

    https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-append#:~:text=,%E3%80%9013%E2%80%A0AppendBlockAsync%E3%80%91

    • Another approach is to use Azure Functions, which can be triggered by events (like a file upload) to perform operations on blobs. This could involve downloading the existing ZIP, adding new files, and re-uploading it. While this approach requires downloading and re-uploading the ZIP file, it can be fully automated using Azure Functions.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.