Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Possible to view progress of download? #40

Open
Broham opened this issue Jul 12, 2018 · 0 comments
Open

Possible to view progress of download? #40

Broham opened this issue Jul 12, 2018 · 0 comments

Comments

@Broham
Copy link

Broham commented Jul 12, 2018

I am attempting to pull down a fairly large file (2 GB).

I took your example and added some logging:

_, err = ftp.Retr(path, func(r io.Reader) error {

	var hasher = sha256.New()
	fmt.Println("Call copy")
	if _, err = io.Copy(hasher, r); err != nil {
		return err
	}
	fmt.Println("after copy")
	hash := fmt.Sprintf("%s %x", path, hex.EncodeToString(hasher.Sum(nil)))
	fmt.Println(hash)
        return nil

But after it logs "Call copy" it sits for quite a while. I assume this is because the file is actually downloading at this point.

I'm wondering if my assumption is correct? If so - is there any way that I can display the download progress periodically while the file is downloading?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant