epubzip

package
v2.0.0-...-c09f89d Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 11 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) Copy

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

func (*EPUBZip) WriteContent

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

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

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

type EPUBZipStorageImageReader

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

func NewEPUBZipStorageImageReader

func NewEPUBZipStorageImageReader(filename string) (*EPUBZipStorageImageReader, error)

func (*EPUBZipStorageImageReader) Close

func (e *EPUBZipStorageImageReader) Close() error

func (*EPUBZipStorageImageReader) Get

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

func (*EPUBZipStorageImageReader) Remove

func (e *EPUBZipStorageImageReader) Remove() error

func (*EPUBZipStorageImageReader) Size

func (e *EPUBZipStorageImageReader) Size(filename string) uint64

type EPUBZipStorageImageWriter

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

func NewEPUBZipStorageImageWriter

func NewEPUBZipStorageImageWriter(filename string, format string) (*EPUBZipStorageImageWriter, error)

func (*EPUBZipStorageImageWriter) Add

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

func (*EPUBZipStorageImageWriter) Close

func (e *EPUBZipStorageImageWriter) Close() error

type ZipImage

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

func CompressImage

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

create gzip encoded jpeg

Jump to

Keyboard shortcuts

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