pipes

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package pipes creates a FIFO pipe and provides functions to read/write to it. It probably only works on Linux, can't confirm if it will work on macOS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pipe

type Pipe struct {
	// contains filtered or unexported fields
}

Pipe is a FIFO pipe.

func New

func New(path string) *Pipe

New returns a pipe instance. The path argument is the place where the FIFO pipe will be created.

func (*Pipe) Create

func (e *Pipe) Create() error

Create creates a new FIFO pipe using syscall.Mkfifo(). In case of error the function returns an error

func (*Pipe) Exists added in v0.2.0

func (e *Pipe) Exists() bool

Exists is wrapper around os.stat() to check if the pipe file exists.

func (*Pipe) Path

func (e *Pipe) Path() string

Path returns the path to the pipe file.

func (*Pipe) Read

func (e *Pipe) Read() ([]byte, error)

Read waits and reads the contents of the pipe. Use after pipe.Create()

func (*Pipe) Reader added in v0.2.0

func (e *Pipe) Reader() (*os.File, error)

Reader returns a reader to the pipe file.

func (*Pipe) Remove

func (e *Pipe) Remove() error

Remove removes the pipe file. In case of failure it returns the error provided by os.Remove()

func (*Pipe) Write

func (e *Pipe) Write(data []byte) error

Write writes data to the pipe. In case of failure it returns an error. Use after pipe.Create()

func (*Pipe) Writer added in v0.2.0

func (e *Pipe) Writer() (*os.File, error)

Writer returns a writer to the pipe file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL