Skip to content

Possible to view progress of download? #40

@Broham

Description

@Broham

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions