은승우

Update app.js

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