epub

package
v0.0.0-...-6e95190 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: BSD-3-Clause Imports: 10 Imported by: 13

Documentation

Index

Constants

View Source
const (
	ContainerFile  = "META-INF/container.xml"
	EncryptionFile = "META-INF/encryption.xml"
	LicenseFile    = "META-INF/license.lcpl"

	ContentType_XHTML = "application/xhtml+xml"
	ContentType_HTML  = "text/html"

	ContentType_NCX = "application/x-dtbncx+xml"

	ContentType_EPUB = "application/epub+zip"
)
View Source
const (
	RootFileElement = "rootfile"
)

root element of the opf

Variables

This section is empty.

Functions

This section is empty.

Types

type Epub

type Epub struct {
	Encryption *xmlenc.Manifest
	Package    []opf.Package
	Resource   []*Resource
	// contains filtered or unexported fields
}

func Read

func Read(r *zip.Reader) (Epub, error)

Read reads the opf file in the zip passed as a parameter, selects resources which mustn't be encrypted and returns an EPUB object

func (*Epub) Add

func (ep *Epub) Add(name string, body io.Reader, size uint64) error

func (Epub) CanEncrypt

func (ep Epub) CanEncrypt(file string) bool

func (Epub) Cover

func (ep Epub) Cover() (bool, *Resource)

func (Epub) Write

func (ep Epub) Write(dst io.Writer) error

type Resource

type Resource struct {
	Path          string
	ContentType   string
	OriginalSize  uint64
	ContentsSize  uint64
	Compressed    bool
	StorageMethod uint16
	Contents      io.Reader
}

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(w io.Writer) *Writer

func (*Writer) AddResource

func (w *Writer) AddResource(path string, storeMethod uint16) (io.Writer, error)

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Copy

func (w *Writer) Copy(r *Resource) error

func (*Writer) WriteEncryption

func (w *Writer) WriteEncryption(enc *xmlenc.Manifest) error

func (*Writer) WriteHeader

func (w *Writer) WriteHeader() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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