Skip to content

Commit

Permalink
U: energy cli
Browse files Browse the repository at this point in the history
  • Loading branch information
sxmxta committed Dec 17, 2024
1 parent d50ad96 commit 6a9458d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/internal/tools/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ package tools
import (
"bufio"
"errors"
"fmt"
"github.com/energye/energy/v2/cmd/internal/term"
"github.com/energye/energy/v2/cmd/internal/tools/rawhttp"
"github.com/pterm/pterm"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
)

// DownloadFile 下载文件
Expand Down Expand Up @@ -58,6 +61,7 @@ func DownloadFile(url, localPath, proxy string, callback func(totalLength, proce
term.Section.Println("File already exists")
return nil
}

file, err := os.Create(tmpFilePath)
if err != nil {
return err
Expand Down Expand Up @@ -134,6 +138,11 @@ func DownloadFile(url, localPath, proxy string, callback func(totalLength, proce
return err
}
term.Section.Println("File Size: ", inf.Size())
// todo test
if strings.Contains(localPath, "liblcl") {
data, _ := ioutil.ReadFile(localPath)
fmt.Println("data:", string(data))
}
}
return err
}

0 comments on commit 6a9458d

Please sign in to comment.