Browse Source

增加远程解压

master
xyiege 1 month ago
parent
commit
016fcc9464
  1. 2
      scalib/build.bat
  2. 15
      scalib/main.go

2
scalib/build.bat

@ -1,5 +1,5 @@
@echo off
color 87
color 8f
set GOOS=linux
set GOARCH=amd64
set CGO_ENABLED=0

15
scalib/main.go

@ -157,10 +157,19 @@ func transferFile(c *UpFileClient, curPath string, uploadPath string) error {
progress := float64(offset) / float64(fileInfo.Size()) * 100
fmt.Printf("\r发送进度: %.2f%%", progress)
}
// 远程调用解压缩
fmt.Println("\n文件发送完成!")
// 文件解压缩
distFullName := filepath.Join(dirPath, fileName)
// 此时调用远程的完整路径,防止解压缩不成功
c.rpcClient.Call("UpFileService.UnzipArchive", FileInfo{
FileName: distFullName,
FileSize: fileInfo.Size(),
}, &reply)
// 输出执行的结果
if reply != "true" {
logger.Error("UnzipArchive failed", zap.String("reply", reply))
}
fmt.Printf("UnzipArchive success, reply: %s\n", reply)
// }()

Loading…
Cancel
Save