UNPKG

covers-extractor

Version:

This library extract cover from a lot of document formats from exact folder

18 lines (17 loc) 416 B
/** * Executes a shell command and return it as a Promise. * @param cmd {string} * @return {Promise<string>} */ function asyncExec(cmd) { const exec = require("child_process").exec; return new Promise((resolve, reject) => { exec(cmd, (error, stdout, stderr) => { if (error) { console.warn(error); } resolve(stdout ? stdout : stderr); }); }); } module.exports = asyncExec;