Documentation
¶
Overview ¶
Package xio provides i/o utilities.
Index ¶
- func CloseIgnoringErrors(closer io.Closer)
- func ContextSleep(ctx context.Context, waitTime time.Duration) error
- func DiscardAndCloseIgnoringErrors(rc io.ReadCloser)
- func RetrieveData(filePathOrURL string) ([]byte, error)
- func RetrieveDataFromURL(urlStr string) ([]byte, error)
- func RetrieveDataFromURLWithContext(ctx context.Context, urlStr string) ([]byte, error)
- func RetrieveDataWithContext(ctx context.Context, filePathOrURL string) ([]byte, error)
- type LineWriter
- type TeeWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseIgnoringErrors ¶
CloseIgnoringErrors closes the closer and ignores any error it might produce. Should only be used for read-only streams of data where closing should never cause an error.
func ContextSleep ¶ added in v1.29.0
ContextSleep sleeps for the specified time, or until the context is done. You can check the return error to see if the context deadline was exceeded by using errors.Is(err, context.DeadlineExceeded).
func DiscardAndCloseIgnoringErrors ¶ added in v1.39.0
func DiscardAndCloseIgnoringErrors(rc io.ReadCloser)
DiscardAndCloseIgnoringErrors reads any content remaining in the body and discards it, then closes the body.
func RetrieveData ¶ added in v1.50.0
RetrieveData loads the bytes from the given file path or URL of type file, http, or https.
func RetrieveDataFromURL ¶ added in v1.23.0
RetrieveDataFromURL loads the bytes from the given URL of type file, http, or https.
func RetrieveDataFromURLWithContext ¶ added in v1.52.0
RetrieveDataFromURLWithContext loads the bytes from the given URL of type file, http, or https.
Types ¶
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
LineWriter buffers its input into lines before sending each line to an output function without the trailing line feed.
func NewLineWriter ¶
func NewLineWriter(out func([]byte)) *LineWriter
NewLineWriter creates a new LineWriter.
func (*LineWriter) Close ¶
func (w *LineWriter) Close() error
Close implements the io.Closer interface.
Directories
¶
Path | Synopsis |
---|---|
Package fs provides filesystem-related utilities.
|
Package fs provides filesystem-related utilities. |
paths
Package paths provides platform-specific standard paths.
|
Package paths provides platform-specific standard paths. |
safe
Package safe provides safe, atomic saving of files.
|
Package safe provides safe, atomic saving of files. |
tar
Package tar provides simple tar extraction.
|
Package tar provides simple tar extraction. |
zip
Package zip provides simple zip extraction.
|
Package zip provides simple zip extraction. |
Package network provides network-related utilities.
|
Package network provides network-related utilities. |
natpmp
Package natpmp provides an implementation of NAT-PMP.
|
Package natpmp provides an implementation of NAT-PMP. |
xhttp
Package xhttp provides HTTP-related utilities.
|
Package xhttp provides HTTP-related utilities. |
xhttp/web
Package web provides a web server with some standardized logging and handler wrapping.
|
Package web provides a web server with some standardized logging and handler wrapping. |
Package term provides terminal utilities.
|
Package term provides terminal utilities. |