import console;
import fsys;
import godking.http;
var url = "https://pc-package.wpscdn.cn/wps/download/W.P.S.60.1955.exe";
var startinfo = {};
var data,header,result = godking.http({
url = url;
file = "C:\Users\Administrator\Desktop\W.P.S.60.1955.exe";
packageSize = 1024*1024;
callback = function(callbackID,已下载大小,总大小,网址,本地文件名){
if !startinfo.time {
startinfo.time = time.tick();
startinfo.size = 已下载大小;
}
if 已下载大小===-1 and 总大小===-1 console.log("下载完毕!");
else {
var time = (time.tick()-startinfo.time)/1000;
var size = 已下载大小-startinfo.size;
if time>0 {
console.dump("下载时间:" ++ time ++ "秒");
console.dump("下载大小:" ++ fsys.formatSize(size));
console.dump("下载速度:" ++ fsys.formatSize(math.round(size/time,0)) ++ "/秒");
}
console.dump("下载进度:" ++ math.round(已下载大小*100/总大小,2) ++ "%",'\n');
}
}
})
if (result.success) {
console.logPause("文件已下载完成,请自行验证文件完整性!");
} else {
console.logPause("下载错误:"++result.info);
}