Showing
1 changed file
with
11 additions
and
2 deletions
... | @@ -86,8 +86,17 @@ async function handleEvent(event) { | ... | @@ -86,8 +86,17 @@ 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 | - var file=fs.createReadStream(chunk); | 89 | + fs.writeFileSync('./photo/image.png', chunk, function (err) { |
90 | - console.log(file); | 90 | + if (err) { |
91 | + console.log('에러발생'); | ||
92 | + console.dir(err); | ||
93 | + return; | ||
94 | + } | ||
95 | + }); | ||
96 | + var file=fs.readFileSync('./photo/image.png','utf8',function (err, data) { | ||
97 | + //파일 다 읽었을 대 호출 됨 | ||
98 | + }); | ||
99 | + console.log(file); | ||
91 | var cheerio = require('cheerio'); | 100 | var cheerio = require('cheerio'); |
92 | 101 | ||
93 | var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr'; | 102 | var uriBase = 'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr'; | ... | ... |
-
Please register or login to post a comment