1 Star 0 Fork 0

JumboWu/grpc-gateway

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
readerfactory.go 403 Bytes
一键复制 编辑 原始数据 按行查看 历史
Roman Azami 提交于 2018-11-19 10:46 . Feature/patch2 rebased (#812)
package utilities
import (
"bytes"
"io"
"io/ioutil"
)
// IOReaderFactory takes in an io.Reader and returns a function that will allow you to create a new reader that begins
// at the start of the stream
func IOReaderFactory(r io.Reader) (func() io.Reader, error) {
b, err := ioutil.ReadAll(r)
if err != nil {
return nil, err
}
return func() io.Reader {
return bytes.NewReader(b)
}, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/jumbowu/grpc-gateway.git
git@gitee.com:jumbowu/grpc-gateway.git
jumbowu
grpc-gateway
grpc-gateway
v1.6.0

搜索帮助