tf

package
v1.11.4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package tf has the functions to extract and convert text files into images.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReadmeBlank = errors.New("readme file cannot be blank or invalid")
	ErrReadmeOff   = errors.New("noreadme bool cannot be false")
	ErrMeNF        = errors.New("readme not found in archive")
	ErrPNG         = errors.New("no such png file")
	ErrPointer     = errors.New("pointer value cannot be nil")
)

Functions

This section is empty.

Types

type TextFile

type TextFile struct {
	ID       uint           // ID is a database auto increment ID.
	UUID     string         // Universal unique ID.
	Name     string         // Name of the file.
	Ext      string         // Ext is the file extension of the name.
	Platform string         // Platform classification for the file.
	Size     int64          // Size of the file in bytes.
	NoReadme sql.NullBool   // NoReadme will disable the display of a readme file on the webpage.
	Readme   sql.NullString // Readme is the filename of a readme or NFO textfile to display on the webpage.
}

TextFile is a text file object.

func (*TextFile) Archive

func (t *TextFile) Archive() bool

Archive confirms that the named file is a known archive.

func (*TextFile) Exist

func (t *TextFile) Exist(dir *directories.Dir) (bool, error)

Exist checks that [UUID].png exists in both thumbnail subdirectories.

func (*TextFile) Extract

func (t *TextFile) Extract(w io.Writer, dir *directories.Dir) error

Extract a textfile readme from an archive.

func (*TextFile) ExtractedImgs

func (t *TextFile) ExtractedImgs(w io.Writer, cfg conf.Config, dir string) error

ExtractedImgs generates PNG and Webp image assets from a textfile extracted from an archive.

func (*TextFile) String

func (t *TextFile) String() string

func (*TextFile) TextPNG added in v1.11.0

func (t *TextFile) TextPNG(w io.Writer, cfg conf.Config, dir string) error

TextPNG generates PNG format image assets from a textfile.

func (*TextFile) WebP

func (t *TextFile) WebP(w io.Writer, c int, imgDir string) (int, error)

WebP finds and generates missing WebP format images.

Jump to

Keyboard shortcuts

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