@likecoin/epub-ts
    Preparing search index...

    Class Book

    An Epub representation with methods for the loading, parsing and manipulation of its contents.

    a request function to use instead of the default

    send the xhr request withCredentials

    send the xhr request headers

    optional to pass 'binary' or base64' for archived Epubs

    use base64, blobUrl, or none for replacing assets in archived Epubs

    optional function to determine canonical urls for a path

    optional string to determine the input type

    cache the contents in local storage, value should be the name of the reader

    new Book("/path/to/book.epub", {})
    
    new Book({ replacements: "blobUrl" })
    

    Implements

    Index

    Constructors

    Properties

    archive: Archive | undefined
    archived: boolean
    container: Container | undefined
    cover: string
    displayOptions: DisplayOptions | undefined
    emit: <K extends string>(type: K, ...args: BookEvents[K]) => void
    isOpen: boolean
    isRendered: boolean
    loaded: BookLoadedState
    loading: BookLoadingState
    locations: Locations
    navigation: Navigation
    off: <K extends string>(type: K, fn?: (...args: BookEvents[K]) => void) => void
    on: <K extends string>(type: K, fn: (...args: BookEvents[K]) => void) => void
    opened: Promise<Book>
    opening: defer<Book>
    package: Packaging | undefined
    packaging: Packaging
    pageList: PageList
    path: Path | undefined
    ready: Promise<
        [
            PackagingManifestObject,
            Spine,
            PackagingMetadataObject,
            string,
            Navigation,
            Resources,
            DisplayOptions,
        ],
    >
    rendition: Rendition | undefined
    resources: Resources
    settings: BookOptions
    spine: Spine
    storage: Store | undefined
    url: Url

    Methods

    • Get a canonical link to a path

      Parameters

      • path: string

      Returns string

      the canonical path string

    • Get the cover url

      Returns Promise<string | null>

      coverUrl

    • Destroy the Book and all associated objects

      Returns void

    • Find a DOM Range for a given CFI Range

      Parameters

      • cfiRange: string

        a epub cfi range

      Returns Promise<Range>

    • Generates the Book Key using the identifier in the manifest or other string provided

      Parameters

      • Optionalidentifier: string

        to use instead of metadata identifier

      Returns string

      key

    • Load a resource from the Book

      Parameters

      • path: string

        path to the resource to load

      • Optional_type: string

      Returns Promise<unknown>

      returns a promise with the requested resource

    • Open a epub or url

      Parameters

      • input: string | ArrayBuffer | Blob

        Url, Path or ArrayBuffer

      • Optionalwhat: string

        force opening as a certain type

      Returns Promise<void>

      of when the book has been loaded

      book.open("/path/to/book.epub")
      
    • Resolve a path to it's absolute position in the Book

      Parameters

      • path: string
      • Optionalabsolute: boolean

        force resolving the full URL

      Returns string

      the resolved path string

    • Gets a Section of the Book from the Spine Alias for book.spine.get

      Parameters

      • target: string | number

      Returns Section | null

    • Set if request should use withCredentials

      Parameters

      • credentials: boolean

      Returns void

    • Set headers request should use

      Parameters

      • headers: Record<string, string>

      Returns void