简体   繁体   English

使用Amazon S3 .Net SDK附加字节

[英]Appending bytes using Amazon S3 .Net SDK

I have the following piece of code which works great for a simple file upload. 我有以下代码,适用于简单的文件上传。 But let's say I wanted to append to an existing file or simply upload random chunks of bytes, like the first and last 10 bytes? 但是,假设我想要附加到现有文件或只是上传随机字节块,比如第一个和最后10个字节? Is this even possible with the official SDK? 官方SDK甚至可以实现这一点吗?

PutObjectRequest request = new PutObjectRequest();

FileStream fs = new FileStream(@"C:\myFolder\MyFile.bin", FileMode.Open);
request.WithInputStream(fs);
request.WithBucketName(bucketName);
request.WithKey(keyName);
client.PutObject(request);
fs.Close();

This previous answer appears to no longer be the case. 之前的答案似乎不再是这种情况。 You can currently manage an append like process by using an existing object as the initial part of a multi-part upload. 您现在可以使用现有对象作为多部分上载的初始部分来管理类似进程的追加。 Then delete the previous object when done transferring. 完成传输后删除上一个对象。

See: 看到:

http://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingLLNetMPUapi.html http://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingLLNetMPUapi.html

http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPartCopy.html http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPartCopy.html

There is no way to append data to existing objects in S3. 无法在S3中将数据附加到现有对象。 You have to overwrite the entire file. 您必须覆盖整个文件。

Although, in saying that, it is possible to a degree with Amazon's large file support. 虽然,在说,有可能在某种程度上亚马逊的大文件支持。 With this uploads are broken into chunks and reassembled on S3. 随着这个上传被分成几个块并在S3上重新组装。 But you have to do it as part of a single transfer and its only for large files. 但是,您必须将其作为单个传输的一部分进行,并且仅针对大型文件。

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

相关问题 使用 .net SDK 从 Amazon S3 存储桶下载文件夹 - Download folder from Amazon S3 bucket using .net SDK Amazon S3 SELECT从S3存储桶中的.csv文件返回垃圾数据(使用.NET SDK) - Amazon S3 SELECT returning garbage data from a .csv file in S3 Bucket (using .NET SDK) 使用AWS S3 SDK for .NET从Amazon S3下载并行批处理文件 - Parallel batch file download from Amazon S3 using AWS S3 SDK for .NET 无法使用适用于Amazon的.NET SDK从Windows Phone将图像上传到Amazon s3 - Unable to upload image to Amazon s3 from Windows Phone using .NET SDK for Amazon 使用AWS SDK for .NET或REST API从Amazon S3检索包含图像和样式表的HTML文件 - Retrieving HTML files with images and style sheets from Amazon S3 using AWS SDK for .NET or REST API Amazon s3 .NET SDK,您尝试访问的存储区必须使用指定的端点进行寻址 - Amazon s3 .NET SDK , the bucket you are trying to access must be addressed using specfied endpoint Amazon S3 .NET SDK只能按2个流上传 - Amazon S3 .NET SDK can upload only by 2 streams S3 和 .net Amazon SDK - 由于保护级别,GetObject 无法访问 - S3 and .net Amazon SDK - GetObject is inaccessible due to protection level 使用虚拟路径提供程序和Amazon S3 SDK上载文件 - Upload file using a virtual path provider and Amazon S3 SDK 如何使用amazon sdk为虚拟域生成预先签名的Amazon S3网址? - How to generate pre-signed Amazon S3 url for a vanity domain, using amazon sdk?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM