[ Cmii ] [ Octopus ] - add Image Function - 1
This commit is contained in:
@@ -522,6 +522,46 @@ func BasicDownloadFile(downloadUrl, desFile string) (downloadOk bool, resultLog
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func BasicDownloadFileWithProxy(downloadUrl, proxyUrl, desFile string) (downloadOk bool, resultLog []string) {
|
||||
|
||||
var ok bool
|
||||
if !BasicCommandExistByPath("curl") {
|
||||
return false, []string{
|
||||
"curl not exits!",
|
||||
}
|
||||
}
|
||||
|
||||
ok, resultLog = AllCommandExecutor([]string{
|
||||
"curl",
|
||||
"-x",
|
||||
proxyUrl,
|
||||
"-o",
|
||||
desFile,
|
||||
"--insecure",
|
||||
"--max-time",
|
||||
"5",
|
||||
downloadUrl,
|
||||
})
|
||||
|
||||
errLog := fmt.Sprintf("[BasicDownloadFileWithProxy] - download file [ %s ] with proxy [ %s ] from [ %s ] failed !", desFile, proxyUrl, downloadUrl)
|
||||
if !ok {
|
||||
log.Error(errLog)
|
||||
return false, []string{
|
||||
errLog,
|
||||
}
|
||||
}
|
||||
// check file exists
|
||||
existAndNotNull := BasicFileExistAndNotNull(desFile)
|
||||
if !existAndNotNull {
|
||||
return false, []string{
|
||||
errLog,
|
||||
"[BasicDownloadFile] - file not exist !",
|
||||
}
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// BasicAppendSourceToFile 将源文件的内容添加到目标文件,使用golang标准库完成,跨平台、安全性更强
|
||||
func BasicAppendSourceToFile(sourceFile, targetFile string) bool {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user