Commit b66203ce by shenyizhong

* code review

1 parent f351eb69
Showing with 2 additions and 4 deletions
......@@ -140,6 +140,7 @@ func Upload(node *nodetree.NodeLoc) {
}
log.Printf("curl %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v -F %v\n", strCmd01, strCmd02, strCmd03, strCmd04, strCmd05, strCmd06, strCmd07, strCmd08, strCmd09, strCmd10)
fmt.Printf("%v\n", node.Path)
cmd := exec.Command("curl", strCmd01, "-F", strCmd02, "-F", strCmd03, "-F", strCmd04, "-F", strCmd05, "-F", strCmd06, "-F", strCmd07, "-F", strCmd08, "-F", strCmd09, "-F", strCmd10)
stdout, err := cmd.StdoutPipe()
......@@ -155,7 +156,6 @@ func Upload(node *nodetree.NodeLoc) {
if opBytes, err := ioutil.ReadAll(stdout); err != nil {
log.Fatal(err)
} else {
fmt.Printf("[%v]\n", node.Path)
log.Println(string(opBytes))
}
}
......@@ -235,7 +235,7 @@ func Download(node *nodetree.NodeRemot) error {
log.Printf("wget -O %v \"%v\"", strDstFile, jsonRes.Data.Url)
fmt.Printf("[%v] ", strDstFile)
fmt.Printf("%v ", nodetree.StrSrc+tmpStrs[1])
res, err := http.Get(jsonRes.Data.Url)
if err != nil {
......@@ -243,14 +243,12 @@ func Download(node *nodetree.NodeRemot) error {
return err
}
defer res.Body.Close()
// 获得get请求响应的reader对象
reader := bufio.NewReaderSize(res.Body, 32*1024)
file, err := os.Create(strDstFile)
if err != nil {
panic(err)
}
// 获得文件的writer对象
writer := bufio.NewWriter(file)
written, _ := io.Copy(writer, reader)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!