初始化分传段任务
功能说明
在指定桶中初始化分段上传任务。
方法定义
ObsClient.initiateMultipartUpload
请求参数
|
字段名 |
类型 |
约束 |
说明 |
|---|---|---|---|
|
Bucket |
String |
必选 |
桶名。 |
|
Key |
String |
必选 |
对象名。 |
|
RequestDate |
String 或 Date |
可选 |
指定请求时间。
说明:
当为String类型时,必须符合ISO8601或RFC822规范。 |
|
ACL |
String |
可选 |
创建对象时可指定的预定义访问策略。 |
|
StorageClass |
String |
可选 |
创建对象时可指定的对象的存储类型。 |
|
Metadata |
Object |
可选 |
对象的自定义元数据信息。 |
|
WebsiteRedirectLocation |
String |
可选 |
当桶设置了Website配置,该参数指明对象的重定向地址。 |
|
Expires |
Number |
可选 |
对象的生命周期,单位:天。 |
|
ContentType |
String |
可选 |
对象的MIME类型。 |
|
SseKms |
String |
可选 |
以SSE-KMS方式加密对象,支持的值:
|
|
SseKmsKey |
String |
可选 |
SSE-KMS方式下加密的主密钥,可为空。 |
|
SseC |
String |
可选 |
以SSE-C方式加密对象,支持的值:
|
|
SseCKey |
String |
可选 |
SSE-C方式下加密的密钥,由AES256算法得到。 |
返回结果(InterfaceResult)
|
字段名 |
类型 |
说明 |
|---|---|---|
|
RequestId |
String |
OBS服务端返回的请求ID。 |
|
Bucket |
String |
分段上传任务的桶名。 |
|
Key |
String |
分段上传任务的对象名。 |
|
UploadId |
String |
分段上传任务的ID。 |
代码样例
obsClient.initiateMultipartUpload({
Bucket:'bucketname',
Key : 'objectkey',
ContentType : 'text/plain'
},function (err, result) {
if(err){
console.error('Error-->' + err);
}else{
if(result.CommonMsg.Status < 300){
console.log('RequestId-->' + result.InterfaceResult.RequestId);
console.log('Bucket-->' + result.InterfaceResult.Bucket);
console.log('Key-->' + result.InterfaceResult.Key);
console.log('UploadId-->' + result.InterfaceResult.UploadId);
}else{
console.log('Code-->' + result.CommonMsg.Code);
console.log('Message-->' + result.CommonMsg.Message);
}
}
});