简体   繁体   English

是否可以将字节附加到 Azure Blob 存储中的 Blob?

[英]Is it possible to append bytes to a blob in Azure Blob Storage?

I had a bit of trouble uploading large files (>2GB) with ASP.NET MVC5 but I managed to fix it by splitting that file in packets with jQuery and uploading each packet separately.我在使用 ASP.NET MVC5 上传大文件(> 2GB)时遇到了一些麻烦,但我设法通过使用 jQuery 将该文件拆分为数据包并分别上传每个数据包来修复它。 In my backend I want to upload those packets to Azure Blob Storage.在我的后端,我想将这些数据包上传到 Azure Blob 存储。 Is there a way to append those bytes to an already existing blob?有没有办法将这些字节附加到已经存在的 blob 中? Most solutions I find on the internet advice to download the blob, add the bytes and re-upload them.我在互联网上找到的大多数解决方案都建议下载 blob,添加字节并重新上传它们。 But I think that's kinda a waste of bandwith since you download and reupload a file all the time但我认为这有点浪费带宽,因为您一直在下载和重新上传文件

Try using append blobs.尝试使用附加 blob。 There is a code sample at https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/#writing-to-an-append-blob . https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/#writing-to-an-append-blob 上有一个代码示例。 From that page:从该页面:

An append blob is a new type of blob, introduced with version 5.x of the Azure storage client library for .NET.追加 blob 是一种新型 blob,随适用于 .NET 的 Azure 存储客户端库的 5.x 版引入。 An append blob is optimized for append operations, such as logging.附加 blob 已针对附加操作(例如日志记录)进行了优化。 Like a block blob, an append blob is comprised of blocks, but when you add a new block to an append blob, it is always appended to the end of the blob.与块 blob 一样,追加 blob 由块组成,但是当您向追加 blob 添加新块时,它始终附加到 blob 的末尾。 You cannot update or delete an existing block in an append blob.不能更新或删除追加 blob 中的现有块。 The block IDs for an append blob are not exposed as they are for a block blob.附加 blob 的块 ID 不会像块 blob 那样公开。

Each block in an append blob can be a different size, up to a maximum of 4 MB, and an append blob can include a maximum of 50,000 blocks.追加 blob 中的每个块的大小可以不同,最大为 4 MB,追加 blob 最多可包含 50,000 个块。 The maximum size of an append blob is therefore slightly more than 195 GB (4 MB X 50,000 blocks).因此,追加 blob 的最大大小略大于 195 GB(4 MB X 50,000 块)。

Azure Blob Storage supports re-composing new blobs from existing blocks in already uploaded (and committed) blobs and combining those existing blocks with new blocks you upload. Azure Blob 存储支持从已上传(和提交)的 Blob 中的现有块重新组合新 Blob,并将这些现有块与您上传的新块组合。 The order of the blocks can be chosen freely, so you can append new blocks or insert new blocks.块的顺序可以自由选择,因此您可以追加新块或插入新块。

Append blobs are mostly used for applications that continuously add data to an object.追加 blob 主要用于不断向对象添加数据的应用程序。

For an overview, check here .如需概览,请查看此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM