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

上传进度 #241

Closed
zHElEARN opened this issue Jul 7, 2020 · 3 comments
Closed

上传进度 #241

zHElEARN opened this issue Jul 7, 2020 · 3 comments
Labels

Comments

@zHElEARN
Copy link

zHElEARN commented Jul 7, 2020

请问用POST请求上传文件时怎么获得上传进度

@guonaihong
Copy link
Owner

目前没有,v0.1.1会开发完。时间在月底之前。

@guonaihong
Copy link
Owner

guonaihong commented Jul 21, 2020

在中间件里面现在已经实现。欢迎使用,issue先关闭,有问题可以打开。

package main

import (
        "bytes"
        "github.com/antlabs/gout-middleware/request"
        "github.com/guonaihong/gout"
)

func main() {
        gout.POST(":8080").RequestUse(request.ProgressBar(func(currBytes, totalBytes int) {

                fmt.Printf("%d:%d-->%f%%\n", currBytes, totalBytes, float64(currBytes)/float64(totalBytes))
        })).SetBody(strings.Repeat("1", 100000) /*构造大点的测试数据,这里换成真实业务数据*/).Do()
}

@zHElEARN
Copy link
Author

zHElEARN commented Aug 8, 2020

okok 谢谢大佬

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

No branches or pull requests

2 participants