[agent-operator] - DLTU download from oss part

This commit is contained in:
zeaslity
2024-04-22 16:47:40 +08:00
parent c8bfb2b133
commit 30d83f3c61
4 changed files with 61 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
package utils
import (
"bufio"
"fmt"
"io"
"os"
"path/filepath"
@@ -160,3 +162,28 @@ func RemoveFolderComplete(folderName string) bool {
}
return true
}
func ReadLineFromFile(fileFullPath string) (result []string) {
f, err := os.Open(fileFullPath)
if err != nil {
fmt.Println(err)
return result
}
defer f.Close()
scanner := bufio.NewScanner(f)
for scanner.Scan() {
line := scanner.Text()
if len(line) > 0 { // ignore empty lines
result = append(result, line)
}
}
if err := scanner.Err(); err != nil {
fmt.Println(err)
return result
}
return result
}