replacecr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package replacecr defines a wrapper for replacing solo carriage return characters (\r) with carriage-return + line feed (\r\n)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reader

func Reader(data io.Reader) io.Reader

Reader wraps an io.Reader. on every call of Read. it looks for for instances of lonely \r replacing them with \r\n before returning to the end consumer lots of files in the wild will come without "proper" line breaks, which irritates go's standard csv package. This'll fix by wrapping the reader passed to csv.NewReader:

rdr, err := csv.NewReader(replacecr.Reader(r))

because Reader adds '\n' characters, the number of bytes reported from the underlying reader can/will differ from what the underlyng reader would return if read from directly. This can cause issues with checksums and byte counts. Use with caution.

func ReaderWithSize added in v0.2.0

func ReaderWithSize(data io.Reader, size int) io.Reader

ReaderWithSize instaties a reader with a given buffer size

Types

This section is empty.

Jump to

Keyboard shortcuts

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