Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OCF

Convenience class to export the internal OCF class for the package as a whole. Conversion methods or functions return an instance of this class, containing the generated EPUB content.

Hierarchy

Index

Constructors

Accessors

Methods

Constructors

constructor

  • new OCF(name: string): OCF
  • Parameters

    • name: string

      the file name of the final package. This is based on the short name of the document, or the name provided in the configuration file.

    Returns OCF

Accessors

container

  • get container(): JSZip
  • Returns the underlying ZIP container; this is used when creating a "collection", ie, when the the final content is generated from several zip containers.

    Returns JSZip

name

  • get name(): string
  • Return the name of the final file, as provided at constructor time. This is based on the short name of the document, or the name provided in the configuration file.

    Returns string

Methods

append

  • append(content: string | stream.Readable, path_name: string): void
  • Store a compressed content in the OCF file. The input can be a simple text or a Stream (the relevant archiver function takes care of disambiguation).

    Parameters

    • content: string | stream.Readable

      Content to be stored

    • path_name: string

      Path name of the file for the content

    Returns void

get_content

  • get_content(): Promise<Buffer | Blob>
  • Return the final content of the book all packed up. If not yet done, the content is generated using the relevant jszip function, packaging all content that has been added.

    async

    Returns Promise<Buffer | Blob>