0

我想知道使用 Appcelerator Titanium 从 Amazon S3 Bucket 下载文件对象的方法。

谁能帮我这个

提前致谢

4

1 回答 1

0
 var downloadingFileUrl = "Url of the file that need to be downloaded"

//File path where downloaded file will be saved
var fileSavingPath = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,"file_Path");

 //Define the http client
 var myHttpClient = Ti.Network.createHTTPClient();

//On success of downloading
myHttpClient.onload = function(){

 //Write the file to the desired path
fileSavingPath.write(httpClient.responseData);
};

//Open the url to download
myHttpClient.open("GET",  downloadingFileUrl);

//Send request
 myHttpClient.send(null);
于 2013-02-19T05:50:30.617 回答