Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// NL is the system-specific newline character (initialized in init()).
NL = "\n"
)
Functions ¶
Types ¶
type ByteSeq ¶
ByteSeq is a generic constraint that allows for types that are underlyingly strings or byte slices.
type FileContent ¶
type FileContent[T ByteSeq] struct { // Filepath is the relative path within the EPUB zip container. Filepath string // Bytes is the content of the file, either as a string or a byte slice. Bytes T }
FileContent represents a file to be included in the EPUB archive, pairing its destination path with its raw data.
func Container ¶
func Container() FileContent[[]byte]
Container returns the mandatory "META-INF/container.xml" file. This file tells the e-reader where the root metadata (OPF) file is located.
func DisplayOptions ¶
func DisplayOptions() FileContent[[]byte]
DisplayOptions returns a configuration file specifically for Apple iBooks to ensure custom embedded fonts are enabled by default.
func Mimetype ¶
func Mimetype() FileContent[[]byte]
Mimetype returns the mandatory "mimetype" file. According to EPUB specs, this must be the first file in the ZIP archive and must be uncompressed.
func NewFileContent ¶
func NewFileContent[T ByteSeq](filepath string, bytes T) FileContent[T]
NewFileContent is a constructor that initializes a FileContent with the given path and data.
func (FileContent[string]) ToBytes ¶
func (f FileContent[string]) ToBytes() FileContent[[]byte]
ToBytes converts a string-based FileContent into a byte-slice-based FileContent, which is often necessary for the final compression stage.