pip
github.com/yaronsumel/pipe
go get github.com/yaronsumel/pipe
pip

github.com/yaronsumel/pipe

small package for reading pipe data

by Yaron Sumel

v0.0.0-20170105065201-be78f1279a72 (see all)License:MIT
go get github.com/yaronsumel/pipe
Readme

pipe Go Report Card GoDoc

small package for reading pipe data

Installation

go get -u github.com/yaronsumel/pipe

Sync Usage

Read is Sync Action to get all pipe data fits in the predifened size

    data,err := pipe.Read(pipe.Stdin,1024)
    if err!=nil{
        //do something with the error
    }

Async Usage

AyncRead will keep reading from the pipe and write it back to StdDataChannel. Don't forget to handle the errors.

    StdinChannel := make(pipe.StdDataChannel)
    go pipe.AsyncRead(pipe.Stdin, 1024, StdinChannel)
    for {
        select {
        case stdin := <-StdinChannel:
            if stdin.Err != nil {
                panic(stdin.Err)
            }
            fmt.Println(stdin.Data)
        }
    }

Working Example

get the command

go get -u github.com/yaronsumel/pipe/pipe-example

run it.pipe it.that's it.

pipe-example --write | pipe-example

GitHub Stars

11

LAST COMMIT

5yrs ago

MAINTAINERS

0

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
v0.0.0-20170105065201-be78f1279a72
2yrs ago
No alternatives found
No tutorials found
Add a tutorial