Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Retrieve a file from offset? #47

Open
itsjwala opened this issue Dec 6, 2019 · 2 comments · May be fixed by #48
Open

Retrieve a file from offset? #47

itsjwala opened this issue Dec 6, 2019 · 2 comments · May be fixed by #48

Comments

@itsjwala
Copy link

itsjwala commented Dec 6, 2019

can this feature be supported where user can specify from where to read?

Current :-

func (c *Client) Retrieve(path string, dest io.Writer) error {

Need :-

func (c *Client) RetrieveFrom(path string, dest io.Writer,bytesSoFar int64) error {
@muirmanders
Copy link
Contributor

What if Retrieve checks if dest is an io.Seeker and if so sets bytesSoFar to the current offset? Or we could add a wrapper type to make this behavior opt-in:

type ResumingWriter struct {
  io.Seeker
}

c.Retreieve(path, &ResumingWriter{myFile})

@itsjwala
Copy link
Author

itsjwala commented Dec 7, 2019

Both will do, its just first one would be more clear. Adding a new function if dest is io.Seeker read from that offset. And current func Retrieve can delegate the call to this new function with offset 0

@marcelthole marcelthole linked a pull request Jan 8, 2020 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants