captcha-service.js
497 Bytes
/**
* Created by TaoHuang on 2016/6/17.
*/
'use strict';
const Promise = require('bluebird');
const co = Promise.coroutine;
const fs = require('fs');
const generateAsync = () => {
const path = './fake_captcha_mer2.png';
const readFileAsync = Promise.promisify(fs.readFile);
return co(function * () {
let data = yield readFileAsync(path);
return {
text: "mer2",
image: data
}
})();
};
module.exports = {
generateAsync
};