은승우

Update app.js

Showing 1 changed file with 3 additions and 1 deletions
...@@ -86,6 +86,7 @@ async function handleEvent(event) { ...@@ -86,6 +86,7 @@ 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 cheerio = require('cheerio'); 90 var cheerio = require('cheerio');
90 91
91 var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr'; 92 var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr';
...@@ -105,7 +106,8 @@ async function handleEvent(event) { ...@@ -105,7 +106,8 @@ async function handleEvent(event) {
105 106
106 request.post(options, function (error, response, body) { 107 request.post(options, function (error, response, body) {
107 console.log(options); 108 console.log(options);
108 - var data=atob(body); 109 + var data= Buffer.from(body, 'base64').toString();
110 +
109 var text=''; 111 var text='';
110 console.log(data); 112 console.log(data);
111 while(data.indexOf('text\\')!=-1) 113 while(data.indexOf('text\\')!=-1)
......