Skip to content

MJKWoolnough/dos2unix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages