Popularity
1.4
Stable
Activity
0.0
Stable
11
4
1

Description

small package for reading pipe data

Programming language: Go
License: MIT License
Tags: Utilities     Linux     Pipe     Stdin     Stderr     Stdout     Redirect    

pipe alternatives and similar packages

Based on the "Utilities" category.
Alternatively, view pipe alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of pipe or a related project?

Add another 'Utilities' Package

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