GithubHelp home page GithubHelp logo

epub-metadata-parser's Introduction

epub-metadata-parser

Introduction

Use it to parse metadata and extract book cover(if available) from epub files so that you can use it in your applications. Outputs a simplified JSON file. Will put the files in the folders given by the user appended by "/Books/Author Name/Book Name". Works in similar fashion to calibredb from Calibre. Only epub files are supported and the files must comply with IDPF Open Packaging Format Specification.

Requirements

Depends on lodash, mkdirp, yauzl, xml2js packages. You can subtitute similar ones as well (i.e underscore for lodash).

Usage

You can extract json file as simple as given in the example below. Note that the first argument is the input file and the second argument is the output directory.

var epubParser = require('epub-metadata-parser');
epubParser.parse('./tester.epub', '../Documents' , book => {
    console.log(book);
});

The outputted JSON file has these properties (cover is undefined if not found):

{ author: 'Lewis Carroll',
  title: 'Alice\'s Adventures in Wonderland',
  description: "Alice\'s Adventures in Wonderland (1865) is a novel written by English author Charles Lutwidge Dodgson, better known under the pseudonym Lewis Carroll. It tells the story of a girl named Alice who falls down a rabbit-hole into a fantasy world populated by peculiar and anthropomorphic creatures.\r\nThe tale is filled with allusions to Dodgson\'s friends (and enemies), and to the lessons that British schoolchildren were expected to memorize. The tale plays with logic in ways that have made the story of lasting popularity with adults as well as children. It is considered to be one of the most characteristic examples of the genre of literary nonsense, and its narrative course and structure has been enormously influential, mainly in the fantasy genre.",
  cover: 'book-cover',
  subject: [ 'Fiction', 'Fantasy', 'Juvenile' ],
  language: 'en',
  publisher: 'Feedbooks',
  pubdate: '1897',
  fileName: 'tester.epub' }

Bugs

After testing the parser with over 2000 books, it seems now stable and handles errors correctly however, any bug reports are most welcomed.

epub-metadata-parser's People

Contributors

aeroith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.