Updated on 2022-09-16 GMT+08:00
Downloading an Object
Sample code:
NSString * outfilePath = [NSTemporaryDirectory() stringByAppendingString:@"filename"]; OBSGetObjectToFileRequest *request = [[OBSGetObjectToFileRequest alloc]initWithBucketName:@"bucketname" objectKey:@"objectname" downloadFilePath:outfilePath]; // Query the download progress. request.downloadProgressBlock = ^(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) { NSLog(@"%0.1f%%",(float)floor(totalBytesWritten*10000/totalBytesExpectedToWrite)/100); }; [client getObject:request completionHandler:^(OBSGetObjectResponse *response, NSError *error){ NSLog(@"%@",response.etag); }];
- When you call getObject, an instance of OBSObject will be returned. This instance contains the content and properties of the object.
- For more information, see Object Download.
Parent topic: Quick Start
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot