How to use the r2-shared-js/dist/es6-es2015/src/parser/epub.EpubParsePromise function in r2-shared-js

To help you get started, we’ve selected a few r2-shared-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github readium / readium-desktop / src / main / sagas / collection-manager.ts View on Github external
], buffer);

    while (true) {
        const action: PublicationImportAction = yield take(chan);
        const publicationDb: PublicationDb = container.get(
            "publication-db") as PublicationDb;
        const publicationStorage: PublicationStorage = container.get(
            "publication-storage") as PublicationStorage;
        const store: Store = container.get("store") as Store;
        const db: PublicationDb = container.get("publication-db") as PublicationDb;
        switch (action.type) {
            case PUBLICATION_IMPORT_ADD:
                for (const path of action.paths) {
                    // Parse epub and extract its metadata
                    Promise.resolve(
                        EpubParsePromise(path)
                        .then((pub: any) => {
                            let authors: Contributor[] = [];

                            if (pub.Metadata && pub.Metadata.Author) {
                                for (let author of pub.Metadata.Author) {
                                    let contributor: Contributor = {
                                        name: author.Name,
                                    };

                                    authors.push(contributor);
                                }
                            }

                            let newPub: Publication = {
                                title: pub.Metadata.Title,
                                description: pub.Metadata.Description,

r2-shared-js

Readium 2 'shared' for NodeJS (TypeScript)

BSD-3-Clause
Latest version published 2 months ago

Package Health Score

60 / 100
Full package analysis