comic

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package comic opens comic book archives: CBZ, a zip archive of images, and CBT, a tar archive of images.

Each image is a page, in the natural order of the names, so that page2.jpg comes before page10.jpg. The first page is the cover (D11). A CBZ file whose images ZipCrypto or the AES of WinZip encrypts opens with the password of ivy.Config, or with its function PasswordFunc (D12). A document describes the comic from its ComicInfo.xml. CBR and CB7 need outside packages for RAR and 7z, and they come as modules of their own after the maintainers approve the packages (D6, D7).

Index

Constants

This section is empty.

Variables

View Source
var Format = ivy.Format{
	Name:  "comic",
	Mimes: []string{"application/vnd.comicbook+zip", "application/x-cbz", "application/x-cbt"},
	Exts:  []string{"cbz", "cbt"},
	Open: func(ctx context.Context, src ivy.Source, cfg ivy.Config) (ivy.Document, error) {
		return Open(ctx, src, WithConfig(cfg))
	},
}

Format describes the package for the registry of a program.

Functions

This section is empty.

Types

type Document

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

Document is an open comic book archive.

func Open

func Open(ctx context.Context, src ivy.Source, opts ...Option) (*Document, error)

Open opens a CBZ or a CBT file. It returns an error that wraps ivy.ErrFormat if src is neither a zip nor a tar archive.

func (*Document) Close

func (d *Document) Close() error

Close satisfies the ivy.Document interface.

func (*Document) Describe

func (d *Document) Describe(ctx context.Context) (ivy.Info, error)

Describe satisfies the ivy.Describer interface. It reads the title, the writers, the language, the date, the publisher and the GTIN of the comic from its ComicInfo.xml. A comic without one has no facts. The title is the field Title, or the fields Series and Number. The GTIN is the field of ComicInfo 2.1 for an ISBN, an EAN or a UPC, and it is the identifier.

func (*Document) Page

func (d *Document) Page(ctx context.Context, n int) (ivy.Page, error)

Page satisfies the ivy.Pager interface. It reads the size of the image, and decodes the image when the page renders.

func (*Document) PageCount

func (d *Document) PageCount(context.Context) (int, error)

PageCount satisfies the ivy.Pager interface. It is the number of images.

func (*Document) Previews

func (d *Document) Previews(ctx context.Context) iter.Seq2[ivy.Preview, error]

Previews satisfies the ivy.Previewer interface. The cover is the first page.

type Option

type Option func(*options)

Option is an option of Open.

func WithConfig

func WithConfig(cfg ivy.Config) Option

WithConfig sets the configuration that every format shares.

Jump to

Keyboard shortcuts

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