Is there a way to get the upload bytes last second in real time?

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!

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?

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

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.