은승우

Update app.js

Showing 1 changed file with 4 additions and 4 deletions
......@@ -86,7 +86,8 @@ async function handleEvent(event) {
.then((stream) => {
stream.on('data', (chunk) => {
console.log(chunk);
var file=fs.createReadStream(chunk);
console.log(file);
var cheerio = require('cheerio');
var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr';
......@@ -98,15 +99,14 @@ async function handleEvent(event) {
language: 'en'
},
headers: {
'Content-Type': 'application/json',
'Content-Type': 'application/octet-stream',
'Ocp-Apim-Subscription-Key': '979dc5d63344438fa4701c62feebb7dc'
},
body: chunk
};
request.post(options, function (error, response, body) {
let jsonRes = JSON.stringify(JSON.parse(body), null, ' ');
console.log(jsonRes);
var text='';
while(data.indexOf('text\\')!=-1)
{
......