pipe Unix风格管道 pipe

polaris • 4741 次点击    
这是一个分享于 的项目,其中的信息可能已经有所发展或是发生改变。
该包使得 Go 应用程序能够像 Unix 中的 pipe 一样使用。 The pipe Go package offers an easy way for Go programs to make use of other applications available in the system via a Unix-like pipeline mechanism. The input and output streams in such pipelines do work as streams, so large content can go across the pipeline without being loaded entirely in memory. The following blog post introduces the concept: http://blog.labix.org/2013/04/15/unix-like-pipelines-for-go 简单例子: ```go package main import ( "fmt" "gopkg.in/pipe.v2" ) func main() { p := pipe.Line( pipe.ReadFile("article.ps"), pipe.Exec("lpr"), ) output, err := pipe.CombinedOutput(p) if err != nil { fmt.Printf("%v\n", err) } fmt.Printf("%s", output) } ```
授权协议:
BSD
开发语言:
golang 查看源码»
操作系统:
*Nix
4741 次点击  ∙  2 赞  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传