Monday, 10 April 2017

Multiple Emails check if exists node.js

I am facing with a small problem and I can't accomplish a bulk email validation to check if emails exists or not.

Let's say I have a list of 10k email addresses and I want to check every email address if is true or not. I am using nodejs and I do not know if this works or not. Or it is the right way to do so?

I have a csv with my email list and I want to save them in the end off another csv file. Thanks in advanced.

var stream = fs.createReadStream("emails-to-process.csv");

var csvStream = csv
    .parse()
    .on("data", function(data){

        emailExistence.check(data[0], function(err,res){
            if(err) { console.log('errror');  }
            if(res)
            {
                fs.appendFileSync('emails-to-save.csv', data[0]+'\n');
            }
        });
    })
    .on("end", function(){
        response.end('done?');
    });
stream.pipe(csvStream);`



via Ionut Carabat

No comments:

Post a Comment