rkonfj
(你知道未来吗)
November 23, 2023, 3:59am
1
Thanks to the nice rclone , I'm using it to develop a sync program, below is the core part of my code:
fs, err := fs.NewFs(ctx, "s3:")
checkErr(err)
fs1 := vfs.New(fs, nil)
src, err := os.Open("/home/rkonfj/a-5g-file.bin")
checkErr(err)
defer src.Close()
dst, err := fs1.OpenFile("/abc/a-5g-file.bin", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
checkErr(err)
n, err := io.Copy(dst, src)
checkErr(err)
err = dst.Close()
checkErr(err)
fmt.Println(n, "bytes copied")
How to get the upload speed last second in real time?
Thanks again!
rkonfj
(你知道未来吗)
November 23, 2023, 4:04am
2
I have implemented a WriterWrapper
to get the number of bytes transferred in the last second, but because of the chunks cache, it is the number of bytes copied to RAM, not the number of bytes copied to the remote.
Is there a way to get the correct last second number of bytes copied?
ncw
(Nick Craig-Wood)
November 23, 2023, 9:36am
3
Take a look at the result of accounting.GlobalStats()
.
Note that we don't provide a stable interface to the rclone code like this - if you want that you will need to use librclone
system
(system)
Closed
January 23, 2024, 5:36am
4
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.