@@ -56,9 +56,9 @@ public async Task<OssResult<ListBucketsResult>> ListBucketsAsync(string region)
56
56
/// <param name="key"></param>
57
57
/// <param name="file"></param>
58
58
/// <returns></returns>
59
- public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , RequestContent file )
59
+ public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , RequestContent file , IDictionary < string , string > extraHeaders = null )
60
60
{
61
- var cmd = new PutObjectCommand ( _requestContext , bucket , key , file , null ) ;
61
+ var cmd = new PutObjectCommand ( _requestContext , bucket , key , file , extraHeaders ) ;
62
62
63
63
return await cmd . ExecuteAsync ( ) ;
64
64
}
@@ -71,16 +71,17 @@ public async Task<OssResult<PutObjectResult>> PutObjectAsync(BucketInfo bucket,
71
71
/// <param name="content"></param>
72
72
/// <param name="mimeType"></param>
73
73
/// <returns></returns>
74
- public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , string content , string mimeType = "text/plain" )
74
+ public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , string content , string mimeType = "text/plain" , ObjectMetadata meta = null , IDictionary < string , string > extraHeaders = null )
75
75
{
76
76
var file = new RequestContent ( )
77
77
{
78
78
ContentType = RequestContentType . String ,
79
79
StringContent = content ,
80
- MimeType = mimeType
80
+ MimeType = mimeType ,
81
+ Metadata = meta
81
82
} ;
82
83
83
- return await PutObjectAsync ( bucket , key , file ) ;
84
+ return await PutObjectAsync ( bucket , key , file , extraHeaders ) ;
84
85
}
85
86
86
87
/// <summary>
@@ -91,18 +92,19 @@ public async Task<OssResult<PutObjectResult>> PutObjectAsync(BucketInfo bucket,
91
92
/// <param name="filePathName"></param>
92
93
/// <returns></returns>
93
94
public async Task < OssResult < PutObjectResult > > PutObjectByFileNameAsync ( BucketInfo bucket , string key ,
94
- string filePathName )
95
+ string filePathName , ObjectMetadata meta = null , IDictionary < string , string > extraHeaders = null )
95
96
{
96
97
using ( var stream = File . OpenRead ( filePathName ) )
97
98
{
98
99
var file = new RequestContent ( )
99
100
{
100
101
ContentType = RequestContentType . Stream ,
101
102
StreamContent = stream ,
102
- MimeType = MimeHelper . GetMime ( filePathName )
103
+ MimeType = MimeHelper . GetMime ( filePathName ) ,
104
+ Metadata = meta
103
105
} ;
104
106
105
- return await PutObjectAsync ( bucket , key , file ) ;
107
+ return await PutObjectAsync ( bucket , key , file , extraHeaders ) ;
106
108
}
107
109
}
108
110
@@ -115,16 +117,17 @@ public async Task<OssResult<PutObjectResult>> PutObjectByFileNameAsync(BucketInf
115
117
/// <param name="mimeType"></param>
116
118
/// <returns></returns>
117
119
public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , Stream content ,
118
- string mimeType = "application/octet-stream" )
120
+ string mimeType = "application/octet-stream" , ObjectMetadata meta = null , IDictionary < string , string > extraHeaders = null )
119
121
{
120
122
var file = new RequestContent ( )
121
123
{
122
124
ContentType = RequestContentType . String ,
123
125
StreamContent = content ,
124
- MimeType = mimeType
126
+ MimeType = mimeType ,
127
+ Metadata = meta
125
128
} ;
126
129
127
- return await PutObjectAsync ( bucket , key , file ) ;
130
+ return await PutObjectAsync ( bucket , key , file , extraHeaders ) ;
128
131
}
129
132
130
133
0 commit comments