epubzip

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

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)

create a new epub

func (*EpubZip) Close

func (e *EpubZip) Close() error

close compress pipe and file.

func (*EpubZip) WriteContent added in v2.3.1

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

Write file. Compressed it using deflate.

func (*EpubZip) WriteMagic

func (e *EpubZip) WriteMagic() error

Write mimetype, in a very specific way. This will be valid with epubcheck tools.

func (*EpubZip) WriteRaw added in v2.3.1

func (e *EpubZip) WriteRaw(raw *ZipImage) error

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

type ZipImage added in v2.3.1

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

func CompressImage added in v2.3.1

func CompressImage(filename string, img image.Image, quality int) *ZipImage

create gzip encoded jpeg

func (*ZipImage) CompressedSize added in v2.3.1

func (img *ZipImage) CompressedSize() uint64

compressed size of the image with the header

Jump to

Keyboard shortcuts

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