| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
11年前发布

利用io.Reader/Writers实现进度条的Go(golang)包:ioprogress

ioprogress是一个Go (golang)库利用 io.Reader 和 io.Writer 来绘制进度条。它主要用在CLI 应用中。

687474703a2f2f672e7265636f726469742e636f2f474f35487854313651482e676966.gif

用法

Here is an example of outputting a basic progress bar to the CLI as we're "downloading" from some other io.Reader (perhaps from a network connection):

// Imagine this came from some external source, such as a network connection,  // and that we have the full size of it, such as from a Content-Length HTTP  // header.  var r io.Reader    // Create the progress reader  progressR := &ioprogress.Reader{      Reader: r,      Size:   rSize,  }    // Copy all of the reader to some local file f. As it copies, the  // progressR will write progress to the terminal on os.Stdout. This is  // customizable.  io.Copy(f, progressR)

项目主页:http://www.open-open.com/lib/view/home/1417953544308

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1417953544308.html
Google Go/Golang开发 ioprogress