Updated on 2023-03-21 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
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.