1 Star 0 Fork 1

技术狼/go-fun

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
io.go 676 Bytes
一键复制 编辑 原始数据 按行查看 历史
技术狼 提交于 1年前 . no message
/*
// @title: io
// @auth: 技术狼(jishulang.com)
*/
package fun
import (
"bytes"
"io"
)
// @title: io.Reader转[]byte
// @param: io.Reader
// @return: []byte
// @description:
// @date: 2022/7/3 21:40
func IoReaderToBytes(reader io.Reader) []byte {
buf := &bytes.Buffer{}
buf.ReadFrom(reader)
data := buf.Bytes()
return data
}
// @title: 获取io.Writer
// @param:
// @return: *bytes.Buffer
// @description:
// @date: 2022/7/3 21:40
func IoWriter() *bytes.Buffer {
return new(bytes.Buffer)
}
// @title: 获取io.Reader
// @param:
// @return: *bytes.Buffer
// @description:
// @date: 2022/7/3 21:40
func IoReader(b []byte) io.Reader {
return bytes.NewReader(b)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/jishulangcom/go-fun.git
git@gitee.com:jishulangcom/go-fun.git
jishulangcom
go-fun
go-fun
v0.0.4

搜索帮助