cavaliergopher / grab

A download manager package for Go
BSD 3-Clause "New" or "Revised" License
1.38k stars 151 forks source link

resp.Size im megabytes #95

Closed ghost closed 2 years ago

ghost commented 2 years ago

Can i get size of downloading file in megabytes , gigabytes?

ghost commented 2 years ago
package main

import (
        "fmt"
)

func main() {
        size := make_magic()
        fmt.Println(size / 1000)
}

func make_magic() (int) {
        xen := 1024
        size := 139772144
        for size > xen {
                size /= xen
                return size
        }
        return size
}