Documentation ¶
Index ¶
- Constants
- func LazyReadCloser(open func() (io.ReadCloser, error)) io.ReadCloser
- func LazyWriteCloser(open func() (io.WriteCloser, error)) io.WriteCloser
- func MimeAlias(m string) string
- func NewEmptySkipper(open func() (io.Writer, error)) io.WriteCloser
- func NopCloser(w io.Writer) io.WriteCloser
- func NormalizeFileMode(mode os.FileMode) os.FileMode
- func SameSkipper(r io.Reader, open func() (io.WriteCloser, error)) io.WriteCloser
- func WriteFile(fsys fs.FS, filename string, content []byte) error
Constants ¶
const ( TextMimetype = "text/plain" CSVMimetype = "text/csv" JSONMimetype = "application/json" JSONArrayMimetype = "application/array+json" TOMLMimetype = "application/toml" YAMLMimetype = "application/yaml" EnvMimetype = "application/x-env" CUEMimetype = "application/cue" )
Variables ¶
This section is empty.
Functions ¶
func LazyReadCloser ¶
func LazyReadCloser(open func() (io.ReadCloser, error)) io.ReadCloser
LazyReadCloser provides an interface to a ReadCloser that will open on the first access. The wrapped io.ReadCloser must be provided by 'open'.
func LazyWriteCloser ¶
func LazyWriteCloser(open func() (io.WriteCloser, error)) io.WriteCloser
LazyWriteCloser provides an interface to a WriteCloser that will open on the first access. The wrapped io.WriteCloser must be provided by 'open'.
func NewEmptySkipper ¶
func NewEmptySkipper(open func() (io.Writer, error)) io.WriteCloser
NewEmptySkipper creates an io.WriteCloser that will only start writing once a non-whitespace byte has been encountered. The wrapped io.WriteCloser must be provided by the `open` func.
func NopCloser ¶
func NopCloser(w io.Writer) io.WriteCloser
NopCloser returns a WriteCloser with a no-op Close method wrapping the provided io.Writer.
func NormalizeFileMode ¶
NormalizeFileMode converts the given mode to a mode that will work as expected on the given OS. A no-op on non-Windows OSes, but on Windows modes work differently - only the owner read/write bits are honoured (i.e. the 0200 mask).
func SameSkipper ¶
func SameSkipper(r io.Reader, open func() (io.WriteCloser, error)) io.WriteCloser
SameSkipper creates an io.WriteCloser that will only start writing once a difference with the current output has been encountered. The wrapped io.WriteCloser must be provided by 'open'.
Types ¶
This section is empty.