var apiKey = "AIzaSyAj9GGrBLnNPImKnl7MKAuD737t1MHnMT8";
var geocoder = require('node-geocoder') ("google", "https", { apiKey: apiKey });
var csv = require('csv');

process.stdin
	.pipe(csv.parse())
	.pipe(csv.transform(function(data, callback){
		setImmediate(function(){
			geocoder.geocode(data[1])
		    .then(function(res) {
				if (res.length === 0) {
					data.push(res[0].latitude);
					data.push(res[0].longitude);
				} else {
					data.push(0);
					data.push(0);
				}
				callback(null, data);
		    })
		    .catch(function(err) {
		        console.log(data[0] + " " + err);
		    });
		});}, {parallel: 1}))
	.pipe(csv.stringify({quotedString: true}))
	.pipe(process.stdout);

var apiKey = "<YOUR-KEY>";
var geocoder = require('node-geocoder') ("google", "https", { apiKey: apiKey });
var csv = require('csv');

process.stdin
	.pipe(csv.parse())
	.pipe(csv.transform(function(data, callback){
		setImmediate(function(){
			geocoder.geocode(data[1])
		    .then(function(res) {
				data.push(res[0].latitude);
				data.push(res[0].longitude);
				callback(null, data);
		    })
		    .catch(function(err) {
		        console.log(data[0] + " " + err);
		    });
		});}, {parallel: 20}))
	.pipe(csv.stringify({quotedString: true}))
	.pipe(process.stdout);

--- 
+++ 
@@ -1,4 +1,4 @@
-var apiKey = "<YOUR-KEY>";
+var apiKey = "AIzaSyAj9GGrBLnNPImKnl7MKAuD737t1MHnMT8";
 var geocoder = require('node-geocoder') ("google", "https", { apiKey: apiKey });
 var csv = require('csv');
 
@@ -8,13 +8,18 @@
 		setImmediate(function(){
 			geocoder.geocode(data[1])
 		    .then(function(res) {
-				data.push(res[0].latitude);
-				data.push(res[0].longitude);
+				if (res.length === 0) {
+					data.push(res[0].latitude);
+					data.push(res[0].longitude);
+				} else {
+					data.push(0);
+					data.push(0);
+				}
 				callback(null, data);
 		    })
 		    .catch(function(err) {
 		        console.log(data[0] + " " + err);
 		    });
-		});}, {parallel: 20}))
+		});}, {parallel: 1}))
 	.pipe(csv.stringify({quotedString: true}))
 	.pipe(process.stdout);
Handle response with 0 results
