const AP = require('article-parser'); var nodePandoc = require('node-pandoc-promise'); const url = process.argv[2]; const getArticle = async (url) => { try { const article = await AP.extract(url); return article; } catch (err) { console.trace(err); } }; getArticle(url).then(res=>{ ` ${res.title} ${res.published} en-US ${res.author} ` // TODO: Write res.content into a temp file const imageUrl = res.image nodePandoc(tmpFile, ['-o', 'filel.epub', '--epbu-cover-image', 'file.png', '--epub-metadata=something.xml']) .then(res=>{ console.log(res); }).catch(err=>{ console.error('Oh No: ',err); }); })