I'm creating Amazon S3 provider, which provides s3 write stream to external code: My provider will be used following way:
// Some external code (provider usage sample)
using (var outStream = provider.GetStreamToWrite(key)) {
fsFileStream.CopyTo(outStream);
}
//S3Provider.cs
Stream GetStreamToWrite(string key)
{
var a3File = new S3FileInfo(_client, config.AWSFileBucket, key);
using (a3File.Create()) { }
_client.PutACL(new PutACLRequest
{
BucketName = _amazonS3StorageConfiguration.AWSFileBucket,
Key = key,
CannedACL = S3CannedACL.PublicRead
});
return a3File.OpenWrite();
}
File created by this code is unpublished, because ACL was resed by stream flush. How to provide published stream to write? Is there some option to publish file after S3FileStream.Flush()?
Aucun commentaire:
Enregistrer un commentaire