"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
cat: Use RangeOption for limited fetches to make more efficient #1825
Nick Craig-Woodabc736df1d25
diff --git a/fs/operations/operations.go b/fs/operations/operations.goindex 19a01dd51..6a2f48734 100644--- a/fs/operations/operations.go+++ b/fs/operations/operations.go@@ -1340,16 +1340,17 @@ func Cat(f fs.Fs, w io.Writer, offset, count int64) error {defer func() {accounting.Stats.DoneTransferring(o.Remote(), err == nil)}()+ opt := fs.RangeOption{Start: offset, End: -1}size := o.Size()- thisOffset := offset- if thisOffset < 0 {- thisOffset += size+ if opt.Start < 0 {+ opt.Start += size+ }+ if count >= 0 {+ opt.End = opt.Start + count - 1}- // size remaining is now reduced by thisOffset- size -= thisOffsetvar options []fs.OpenOption- if thisOffset > 0 {- options = append(options, &fs.SeekOption{Offset: thisOffset})+ if opt.Start > 0 || opt.End >= 0 {+ options = append(options, &opt)}in, err := o.Open(options...)if err != nil {