问题
I am creating an S3 client with a modified buffer size, however, it does not seem to make a difference as always the same amount of bytes is read from the stream. Example code:
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(...)
});
When I debug this example, however, instead of reading a megabyte at a time from MyCustomStream
, the buffer size is 81920 bytes which is the default for Stream
. This leads me to think that the AWS implementation has not overridden the size.
From the documentation I assume that this is the correct property - int BufferSize : The BufferSize controls the buffer used to read in from input streams and write out to the request.
I am indeed reading from an input stream so I would expect that this would get overridden.
来源:https://stackoverflow.com/questions/61917654/aws-s3-buffer-size-not-increasing