Skip to content

yaronsumel/pipe

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

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

About

small package for reading pipe data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages