zloylos / grsync Goto Github PK
View Code? Open in Web Editor NEWGolang rsync wrapper
License: MIT License
Golang rsync wrapper
License: MIT License
Running the code below will create "remote:/var/tmp/" locally.
task := grsync.NewTask(
"./file.txt",
"remote:/var/tmp/",
grsync.RsyncOptions{
Archive: true,
HumanReadable: true,
Verbose: true,
Rsh: "ssh",
},
)
go func() {
for {
state := task.State()
fmt.Printf(
"progress: %.2f / rem. %d / tot. %d / sp. %s \n",
state.Progress,
state.Remain,
state.Total,
state.Speed,
)
time.Sleep(time.Second)
}
}()
if err := task.Run(); err != nil {
panic(err)
}
fmt.Println("well done")
fmt.Println(task.Log())
It seems that creating the directory when the destination-dir does not exist is affecting.
Is it possible to skip creating this directory?
建议加上--bwlimit= 限速参数
I noticed the versioned releases (such as 1.3.0) don't show up on pkg.go.dev. My initial guess is that go.dev expects the tags to have a v
prefix.
https://pkg.go.dev/github.com/zloylos/grsync?tab=versions
Thank you
I cannot get the transfer speed of the last file. Is there something wrong with the code below:
func getTaskSpeed(data [][]string) string {
if len(data) < 2 || len(data[1]) < 2 {
return ""
}
return data[1][1]
}
why return nil when the data's length is less than 2? I think it should be modified to return nil when the data's length is less than 1 but not 2:
func getTaskSpeed(data [][]string) string {
if len(data) < 1 || len(data[0]) < 2 {
return ""
}
return data[0][0]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.