AWS S3 缓冲区大小没有增加

vsi*_*sir 5 c# stream amazon-s3 amazon-web-services

我正在创建一个修改了缓冲区大小的 S3 客户端,但是,它似乎没有什么区别,因为从流中读取的字节数始终相同。示例代码:

var s3Client = new AmazonS3Client(access, secret, token, new AmazonS3Config
{
     RegionEndpoint = Amazon.RegionEndpoint.USEast1,
     BufferSize = 1000000, // 1 MB (completely arbitrary)
});

await s3Client.PutObjectAsync(new PutObjectRequest 
{
     Key = fileName,
     Bucket = bucketName,
     InputStream = new MyCustomStream(...)
});
Run Code Online (Sandbox Code Playgroud)

MyCustomStream然而,当我调试此示例时,缓冲区大小不是从 一次读取一兆字节,而是 81920 字节,这是 的默认值Stream。这让我认为 AWS 实施并未覆盖该大小。

从文档中我假设这是正确的属性 -int BufferSize : The BufferSize controls the buffer used to read in from input streams and write out to the request.我确实正在从输入流中读取,所以我希望这会被覆盖。