dos2unix

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: ISC Imports: 2 Imported by: 1

README

dos2unix

-- import "vimagination.zapto.org/dos2unix"

Package dos2unix provides functions to convert between dos and unix line termination styles

Usage

func DOS2Unix
func DOS2Unix(r io.Reader) io.Reader

DOS2Unix wraps a byte reader with a reader that replaces all instances of \r\n with \n

func Unix2DOS
func Unix2DOS(r io.Reader) io.Reader

Unix2DOS wraps a byte reader with a reader that replaces all instances of \n with \r\n.

When reading from a non-buffered input, it is recommended to wrap the Reader with a bufio.Reader.

func Unix2DOSWriter
func Unix2DOSWriter(w io.Writer) io.Writer

Unix2DOSWriter wraps a io.Writer to convert \n into \r\n

type WriteFlusher
type WriteFlusher interface {
	io.Writer
	Flush() error
}

WriteFlusher combines the io.Writer interface with a buffer Flush method

func DOS2UnixWriter
func DOS2UnixWriter(w io.Writer) WriteFlusher

DOS2UnixWriter wraps a writer to convert \r\n into \n. It is advisable to call the Flush method upon completion as a final \r may be buffered

Documentation

Overview

Package dos2unix provides functions to convert between dos and unix line termination styles

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DOS2Unix

func DOS2Unix(r io.Reader) io.Reader

DOS2Unix wraps a byte reader with a reader that replaces all instances of \r\n with \n

func Unix2DOS

func Unix2DOS(r io.Reader) io.Reader

Unix2DOS wraps a byte reader with a reader that replaces all instances of \n with \r\n.

When reading from a non-buffered input, it is recommended to wrap the Reader with a bufio.Reader.

func Unix2DOSWriter

func Unix2DOSWriter(w io.Writer) io.Writer

Unix2DOSWriter wraps a io.Writer to convert \n into \r\n

Types

type WriteFlusher

type WriteFlusher interface {
	io.Writer
	Flush() error
}

WriteFlusher combines the io.Writer interface with a buffer Flush method

func DOS2UnixWriter

func DOS2UnixWriter(w io.Writer) WriteFlusher

DOS2UnixWriter wraps a writer to convert \r\n into \n. It is advisable to call the Flush method upon completion as a final \r may be buffered

Jump to

Keyboard shortcuts

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