0
nodejs関数に次のコードがあります。 IF条件が真であっても、stringResponse変数の値が更新されていません。nodejsコードの値にアクセスできない
var fs = require('fs'),
byline = require('byline');
var stream = fs.createReadStream('Solutionbank.csv');
var stringResponse = "We found a similar issue. ";
stream = byline.createStream(stream);
stream.on('data', function(line) {
var csvLine = line.toString('utf8');
csvLine = csvLine.toLowerCase().trim();
var msgText = subject.toLowerCase().trim();
//console.log("email block",msgText);
if(csvLine.indexOf(msgText) > -1) {
var arr = line.toString('utf8').split(",");
stringResponse = stringResponse + "Issue ID"+arr[0]+",Subject : "+arr[1]+", Resolution Comment:"+arr[2];
console.log(stringResponse);
}
});
console.log("stringResponse from email",stringResponse);