detail

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checksums

type Checksums struct {
	CRC32  string `json:"crc32" xml:"crc32"`
	CRC64  string `json:"crc64" xml:"crc64"`
	MD5    string `json:"md5" xml:"md5"`
	SHA256 string `json:"sha256" xml:"sha256"`
}

Checksums and hashes of the file.

type Content

type Content struct {
	Type  string `json:"-" xml:"-"`
	Media string `json:"media" xml:"media"`
	Sub   string `json:"subMedia" xml:"sub_media"`
	Commt string `json:"comment" xml:"comment"`
}

Content metadata from either MIME content type and magic file data.

type Detail

type Detail struct {
	XMLName    xml.Name     `json:"-" xml:"file"`
	Name       string       `json:"filename" xml:"name"`
	Unicode    string       `json:"unicode" xml:"unicode,attr"`
	LineBreak  LineBreaks   `json:"lineBreak" xml:"line_break"`
	Count      Stats        `json:"counts" xml:"counts"`
	Size       Sizes        `json:"size" xml:"size"`
	Lines      int          `json:"lines" xml:"lines"`
	Width      int          `json:"width" xml:"width"`
	Modified   ModDates     `json:"modified" xml:"last_modified"`
	Sums       Checksums    `json:"checksums" xml:"checksums"`
	Mime       Content      `json:"mime" xml:"mime"`
	Slug       string       `json:"slug" xml:"id,attr"`
	Sauce      sauce.Record `json:"sauce" xml:"sauce"`
	ZipComment string       `json:"zipComment" xml:"zip_comment"`
	UTF8       bool
	// contains filtered or unexported fields
}

Detail of a file.

func (*Detail) Ctrls

func (d *Detail) Ctrls(name string) error

Ctrls counts the number of ANSI escape controls in the named file.

func (*Detail) Len

func (d *Detail) Len(name string) error

Len counts the number of characters used per line in the named file.

func (*Detail) LineBreaks

func (d *Detail) LineBreaks(r [2]rune)

LineBreaks determines the new lines characters found in the rune pair.

func (*Detail) LineTotals

func (d *Detail) LineTotals(name string) error

LineTotals counts the totals lines in the named file.

func (*Detail) Marshal

func (d *Detail) Marshal(f Format) ([]byte, error)

Marshal the Detail data to a text format syntax.

func (*Detail) MimeUnknown

func (d *Detail) MimeUnknown()

MimeUnknown detects non-Standard legacy data.

func (*Detail) Parse

func (d *Detail) Parse(name string, stat os.FileInfo, data ...byte) error

Parse the file and the raw data content.

func (*Detail) Read

func (d *Detail) Read(name string) error

Read and parse the named file and content.

func (*Detail) ValidText

func (d *Detail) ValidText() bool

ValidText returns true if the MIME content-type value is valid for text files.

func (*Detail) Words

func (d *Detail) Words(name string) error

Words counts the number of words used in the named file.

type Format

type Format uint

Format of the text to output.

const (
	// ColorText is ANSI colored text.
	ColorText Format = iota
	// PlainText is standard text.
	PlainText
	// JSON data-interchange format.
	JSON
	// JSONMin is JSON data minified.
	JSONMin
	// XML markup data.
	XML
)

type LineBreaks

type LineBreaks struct {
	Abbr     string  `json:"string" xml:"string,attr"`
	Escape   string  `json:"escape" xml:"-"`
	Decimals [2]rune `json:"decimals" xml:"decimal"`
}

LineBreaks for new line toggles.

type ModDates

type ModDates struct {
	Time  time.Time `json:"iso" xml:"date"`
	Epoch int64     `json:"epoch" xml:"epoch,attr"`
}

ModDates is the file last modified dates in multiple output formats.

type Sizes

type Sizes struct {
	Bytes   int64  `json:"bytes" xml:"bytes"`
	Decimal string `json:"decimal" xml:"decimal,attr"`
	Binary  string `json:"binary" xml:"binary,attr"`
}

Sizes of the file in multiples.

type Stats

type Stats struct {
	Chars    int `json:"characters" xml:"characters"`
	Controls int `json:"ansiControls" xml:"ansi_controls"`
	Words    int `json:"words" xml:"words"`
}

Stats are the text file content statistics and counts.

Jump to

Keyboard shortcuts

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