Hi ,

I have to download files to local from remote using ftp

please suggest me if you have another option.

 // Download each file into local memory, and calculate it's sha256 hash
    err = ftp.Walk("/", func(path string, info os.FileMode, err error) error {
        _, err = ftp.Retr(path, func(r io.Reader) error {
            var hasher = sha256.New()
            if _, err = io.Copy(hasher, r); err != nil {
                return err
            }

            hash := fmt.Sprintf("%s %x", path,
hex.EncodeToString(hasher.Sum(nil)))
            fmt.Println(hash)

            return err
        })

        return nil
    })

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGJcSR38ZOsu4PEUxSYfshLsLb2bP7suSQbYS%3DwFicXHPTYaaQ%40mail.gmail.com.

Reply via email to