inout

package module
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 4

README

inout

Build Status

Retrieves contents of the provided source: STDIN, HTTP(S) or FS.

Installation

Binary

Get the latest release by running this command in your shell:

For MacOS:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/zoomio/inout/master/_bin/install.sh)" -o darwin

For MacOS (arm64):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/zoomio/inout/master/_bin/install.sh)" -o darwin arm64

For Linux:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/zoomio/inout/master/_bin/install.sh)" -o linux

For Windows:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/zoomio/inout/master/_bin/install.sh)" -o windows
Go dependency
go get -u github.com/zoomio/inout/...

Usage

See cmd/cli/cli.go

Changelog

See CHANGELOG.md

License

Released under the Apache License 2.0.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Source sets target source of the In-Out.
	Source = func(source string) Option {
		return func(c *config) {
			c.source = source
		}
	}

	// Query sets CSS query for the target of In-Out.
	Query = func(query string) Option {
		return func(c *config) {
			c.query = query
		}
	}

	// WaitFor sets CSS query for the target of In-Out.
	WaitFor = func(query string) Option {
		return func(c *config) {
			c.waitFor = query
		}
	}

	// WaitUntil sets page load duration to wait for.
	WaitUntil = func(d time.Duration) Option {
		return func(c *config) {
			c.waitUntil = d
		}
	}

	// Screenshot captures screenshot, Reader will ImgBytes of the image populated.
	Screenshot = func(v bool) Option {
		return func(c *config) {
			c.screenshot = v
		}
	}

	// Timeout sets timeout for the operation.
	Timeout = func(timeout time.Duration) Option {
		return func(c *config) {
			c.timeout = timeout
		}
	}

	// Verbose enables verbose mode.
	Verbose = func(verbose bool) Option {
		return func(c *config) {
			c.verbose = verbose
		}
	}

	// UserAgent custom user agent for healess Chrome operations.
	UserAgent = func(ua string) Option {
		return func(c *config) {
			c.userAgent = ua
		}
	}
)

Functions

This section is empty.

Types

type Option added in v0.6.0

type Option func(*config)

Option allows to customise instance of In-Out.

type Reader

type Reader struct {
	ImgBytes []byte
	// contains filtered or unexported fields
}

Reader - Input. This struct provides methods for reading strings and numbers from standard input, file input, URLs, and sockets.

func New

func New(ctx context.Context, source string) (Reader, error)

New initializes an instance of Reader from STDIN, file or web page.

source - the filename or web page name, reads from STDIN if name is empty. Panics on errors.

func NewFromString

func NewFromString(input string) *Reader

NewFromString initializes an input from string.

func NewInOut added in v0.6.0

func NewInOut(ctx context.Context, options ...Option) (Reader, error)

NewInOut initializes an instance of Reader from STDIN, file or web page.

source - the filename or web page name, reads from STDIN if name is empty. Panics on errors.

func (*Reader) Close

func (in *Reader) Close() error

Close closes reader.

func (*Reader) Read added in v0.3.0

func (in *Reader) Read(p []byte) (n int, err error)

Read reads into given bytes (does not close reader).

func (*Reader) ReadLine added in v0.2.0

func (in *Reader) ReadLine() (string, error)

ReadLine reads line from reader (does not close reader).

func (*Reader) ReadLines added in v0.2.0

func (in *Reader) ReadLines() ([]string, error)

ReadLines provides slice of all text lines from input and closes the reader.

func (*Reader) ReadWords added in v0.2.0

func (in *Reader) ReadWords() ([]string, error)

ReadWords provides slice of all words from input split by white space and closes the reader.

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

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