epubzip

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package epubzip Helper to write EPUB files.

We create a zip with the magic EPUB mimetype.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EPUBZip

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

func New

func New(path string) (EPUBZip, error)

New create a new EPUB

func (EPUBZip) Close

func (e EPUBZip) Close() error

Close compress pipe and file.

func (EPUBZip) Copy

func (e EPUBZip) Copy(fz *zip.File) error

func (EPUBZip) WriteContent

func (e EPUBZip) WriteContent(file string, content []byte) error

WriteContent Write file. Compressed it using deflate.

func (EPUBZip) WriteMagic

func (e EPUBZip) WriteMagic() error

WriteMagic Write mimetype, in a very specific way.

This will be valid with epubcheck tools.

func (EPUBZip) WriteRaw

func (e EPUBZip) WriteRaw(raw Image) error

WriteRaw Write image. They are already compressed, so we write them down directly.

type Image

type Image struct {
	Header *zip.FileHeader
	Data   []byte
}

func CompressImage

func CompressImage(filename string, format string, img image.Image, quality int) (Image, error)

CompressImage create gzip encoded jpeg

type StorageImageReader

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

func NewStorageImageReader

func NewStorageImageReader(filename string) (StorageImageReader, error)

func (StorageImageReader) Close

func (e StorageImageReader) Close() error

func (StorageImageReader) Get

func (e StorageImageReader) Get(filename string) *zip.File

func (StorageImageReader) Remove

func (e StorageImageReader) Remove() error

func (StorageImageReader) Size

func (e StorageImageReader) Size(filename string) uint64

type StorageImageWriter

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

func NewStorageImageWriter

func NewStorageImageWriter(filename string, format string) (StorageImageWriter, error)

func (StorageImageWriter) Add

func (e StorageImageWriter) Add(filename string, img image.Image, quality int) error

func (StorageImageWriter) Close

func (e StorageImageWriter) Close() error

Jump to

Keyboard shortcuts

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