diff --git a/pkg/storage/rclone/rclone.go b/pkg/storage/rclone/rclone.go index a0ff6ba..0b1e21b 100644 --- a/pkg/storage/rclone/rclone.go +++ b/pkg/storage/rclone/rclone.go @@ -84,6 +84,15 @@ func (s *rcloneStorage) Pull(ctx context.Context, rpath string, w io.Writer) err return err } +func (s *rcloneStorage) ReadObject(ctx context.Context, rpath string) (io.ReadCloser, error) { + rpath = normalizeRemotePath(rpath) + obj, err := s.f.NewObject(ctx, rpath) + if err != nil { + return nil, err + } + return obj.Open(ctx) +} + func (s *rcloneStorage) Remove(ctx context.Context, rpath string, recursive bool) error { rpath = normalizeRemotePath(rpath) if !recursive { diff --git a/pkg/storage/types.go b/pkg/storage/types.go index a701752..e7e6634 100644 --- a/pkg/storage/types.go +++ b/pkg/storage/types.go @@ -56,6 +56,9 @@ type Storage interface { // Stat returns the information about the given path. // The `rpath` parameter can be a file. Stat(ctx context.Context, rpath string) (StatResult, error) + + // ReadObject reads a file. + ReadObject(ctx context.Context, rpath string) (io.ReadCloser, error) } type staticDirEntry struct {