Skip to content

How can I tell the version using the publicationParser (e.g. EPUB 2 vs. EPUB 3)? #53

@jdempcy

Description

@jdempcy

I see that you can get the version from the OPF, but that requires passing in a zip. We are currently using r2-shared-js and already have the publicationParser working (it works great! So thanks for that!). But we would like to be able to tell if it's an EPUB 2 or EPUB 3 or higher, just from the publicationParser.

Here is an excerpt of what we are doing:

        const pub = await publicationParser.PublicationParsePromise(path);

        if (typeof pub.Metadata.Title === "string") {
            bookTitle = pub.Metadata.Title;
            coverUrl = pub.GetCover()?.Href || '';
            manifest = serializable.TaJsonSerialize(pub);

            const zipInternal = pub.findFromInternal("zip");
            if (!zipInternal) {
                throw new Error("There is no publication zip!");
            }

It would be nice if we could check, for instance. pub.Version and be able to tell the EPUB version. Is there another way to do this?

Thanks!
Jonah

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions