sethvincent / ebook-convert

wrapper around calibre's ebook-convert command
Other
80 stars 18 forks source link

emits exit instead of end on conversion completion #2

Closed javamonn closed 7 years ago

javamonn commented 8 years ago

Hello,

It looks like you're emitting an exit event on completion, rather than end, which is confusing as end is used in both the README and your tests.

https://github.com/sethvincent/ebook-convert/blob/master/index.js#L32

Schachte commented 8 years ago

Yah I second this. Couldn't figure out the error with onsuccess function until I replaced string with 'exit'

sethvincent commented 7 years ago

I rewrote this module for v2 so that it is now just a single function call:

var path = require('path')
var convert = require('ebook-convert')

// see more options at https://manual.calibre-ebook.com/generated/en/ebook-convert.html
var options = {
  input: path.join(__dirname, 'example.html'),
  output: path.join(__dirname, 'example.epub'),
  authors: '"Seth Vincent"',
  pageBreaksBefore: '//h:h1',
  chapter: '//h:h1',
  insertBlankLine: true,
  insertBlankLineSize: '1',
  lineHeight: '12',
  marginTop: '50',
  marginRight: '50',
  marginBottom: '50',
  marginLeft: '50'
}

/*
* create epub file
*/
convert(options, function (err) {
  if (err) console.log(err)
})