은승우

Update app.js

Showing 1 changed file with 6 additions and 6 deletions
......@@ -88,11 +88,7 @@ async function handleEvent(event) {
.then(
async(stream) => {
await stream.on('data', (chunk) => {
file = chunk;
console.log(chunk);
});
}
);
fs.writeFileSync('./photo/1.png',chunk);
console.log(file);
var cheerio = require('cheerio');
var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr';
......@@ -106,7 +102,7 @@ async function handleEvent(event) {
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': '979dc5d63344438fa4701c62feebb7dc'
},
body: file
body: fs.readFileSync('./photo/1.png')
};
console.log(options.body);
request.post(options, function (error, response, body) {
......@@ -143,6 +139,10 @@ async function handleEvent(event) {
client.replyMessage(event.replyToken,result).then(resolve).catch(reject);
});
});
});
}
);
});
}
......