pipes

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Overview

The pipes package creates a FIFO pipe and provides functions to read/write to it.

After creating the Pipe instance with pipes.New() use pipe.Create() to actually create the pipe file.

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
}

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.

This constructor is necessary as the path has to be previously defined before creating a new pipe to mantain the pipe file path consistent.

func (*Pipe) Create

func (e *Pipe) Create() error

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

func (*Pipe) Path

func (e *Pipe) Path() string

func (*Pipe) Read

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

Waits and reads the contents of the pipe.

Use after pipe.Create()

func (*Pipe) Remove

func (e *Pipe) Remove() error

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

Writes data to the pipe. In case of failure it returns an error.

Use after pipe.Create()

Jump to

Keyboard shortcuts

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