Promise support
Richienb opened this issue · 4 comments
Richienb commented
It would be nice if image-to-ascii supported returning promises.
rmlzy commented
async _convert(imgPath) {
return new Promise((resolve, reject) => {
imageToAscii(imgPath, { colored: false }, (err, converted) => {
if (err) {
reject(err);
return;
}
resolve(converted);
});
});
}
You can wrap it yourself
Richienb commented
@rmlzy Or I could use pify
:
const pify = require("pify")
const imageToAscii = pify(require("image-to-ascii"))
IonicaBizau commented
You can use util.promisify
for now. Maybe in a future version Promises will be added. Contributions are welcome.