aio

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package aio provides buffered file I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddReadSuffix

func AddReadSuffix(suffix string, f func(io.Reader) (io.Reader, error))

AddReadSuffix adds a supported suffix for automatic decompression. suffix should include the dot. f should take a raw reader and return a reader that decompresses the data.

func AddWriteSuffix

func AddWriteSuffix(suffix string, f func(io.WriteCloser) (
	io.WriteCloser, error))

AddWriteSuffix adds a supported suffix for automatic compression. suffix should include the dot. f should take a raw writer and return a writer that compresses the data.

Types

type Reader

type Reader struct {
	bufio.Reader
	// contains filtered or unexported fields
}

func Open

func Open(file string) (*Reader, error)

Open opens a file for reading, with a buffer. Decompresses the data according to the file's suffix.

func OpenRaw

func OpenRaw(file string) (*Reader, error)

OpenRaw opens a file for reading, with a buffer.

func (*Reader) Close

func (r *Reader) Close() error

type Writer

type Writer struct {
	bufio.Writer
	// contains filtered or unexported fields
}

func Append

func Append(file string) (*Writer, error)

Append opens a file for writing, with a buffer. Appends to previously existing content if any. Compresses the data according to the file's suffix.

func AppendRaw

func AppendRaw(file string) (*Writer, error)

AppendRaw opens a file for writing, with a buffer. Appends to previously existing content if any.

func Create

func Create(file string) (*Writer, error)

Create opens a file for writing, with a buffer. Erases any previously existing content. Compresses the data according to the file's suffix.

func CreateRaw

func CreateRaw(file string) (*Writer, error)

CreateRaw opens a file for writing, with a buffer. Erases any previously existing content.

func (*Writer) Close

func (w *Writer) Close() error

Jump to

Keyboard shortcuts

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