Updated on 2022-02-10 GMT+08:00
Resumable Download
API Description
This API is an encapsulated and enhanced version of partial download, and aims to eliminate large file download failures caused by poor network conditions and program breakdowns.
Method Definition
func (obsClient ObsClient) DownloadFile(input *DownloadFileInput) (output *GetObjectMetadataOutput, err error)
Request Parameters
Field |
Type |
Optional or Mandatory |
---|---|---|
input |
Mandatory |
Returned Results
Field |
Type |
---|---|
output |
|
err |
error |
Sample Code
func main() { input := &obs.DownloadFileInput{} input.Bucket = "bucketname" input.Key = "objectname" input.DownloadFile = "localfile" // Full path to which objects are downloaded. input.EnableCheckpoint = true // Enable the resumable download mode. input.PartSize = 9 * 1024 * 1024 // Set the part size to 9 MB. input.TaskNum = 5 // Specify the maximum number of parts that can be concurrently downloaded. output, err := obsClient.DownloadFile(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) } else if obsError, ok := err.(obs.ObsError); ok { fmt.Printf("Code:%s\n", obsError.Code) fmt.Printf("Message:%s\n", obsError.Message) } }
Parent topic: Other APIs
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