convert

package
v0.0.0-3.14.5-20260602... Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

README

Documentation

Overview

Package convert provides utilities for converting content such as line endings and determining binary files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCRLFWriter

func NewCRLFWriter(w io.Writer) io.Writer

NewCRLFWriter wraps a writer to convert LF line endings into CRLF line endings. It assumes that data is text; not binary. See Stat.IsBinary.

func NewLFWriter

func NewLFWriter(w io.Writer) io.Writer

NewLFWriter wraps a writer to convert CRLF line endings into LF line endings. It assumes that data is text; not binary. See Stat.IsBinary.

Types

type Stat

type Stat struct {
	NUL, LoneCR, LoneLF, CRLF uint
	Printable, NonPrintable   uint
}

Stat holds statistics about the content being analyzed.

func GetStat

func GetStat(r io.Reader) (stat Stat, err error)

GetStat returns Stat of the reader based on: https://git.kernel.org/pub/scm/git/git.git/tree/convert.c?id=HEAD#n45

func (Stat) IsBinary

func (s Stat) IsBinary() bool

IsBinary detects if data is binary based on: https://git.kernel.org/pub/scm/git/git.git/tree/convert.c?id=HEAD#n94

Jump to

Keyboard shortcuts

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