Skip to content

Instantly share code, notes, and snippets.

@cyrilis
Created April 23, 2014 15:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyrilis/11220177 to your computer and use it in GitHub Desktop.
Save cyrilis/11220177 to your computer and use it in GitHub Desktop.
KindleGen_wrapper in node.js
# KindleGen
child_process = require 'child_process'
cmd = child_process.exec
module.exports = (options)->
new KindleGen
KindleGen = (options)->
@source = options.source;
@target = options.target;
@kindlegenDir = __dirname + '/KindleGen/kindlegen_'+process.platform
kindlegenCmd = @kindlegenDir + " " + @source + ' -o '+ @target
mobi = cmd kindlegenCmd, (err,stdout,stderr)->
if err and options.error
options.error err
if options.success
options.success stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment