开发者

How to read at least N bytes in Go

开发者 https://www.devze.com 2023-04-11 21:52 出处:网络
How do you ensure you get at least n bytes when reading from a file in Go? The function seems 开发者_Python百科to return the number of bytes you got, but I would rather just wait until more bytes are

How do you ensure you get at least n bytes when reading from a file in Go? The function seems 开发者_Python百科to return the number of bytes you got, but I would rather just wait until more bytes are available. Is this possible without doing a bunch of manual plumbing?


Use io.ReadAtLeast() function: http://golang.org/pkg/io/#ReadAtLeast

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号