replacecr

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 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). Copied from https://github.com/qri-io/starlib/tree/master/util/replacecr

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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