then is not a function error - Node promise library
<p>I'm new to Node and this is the first time I've tried to use a promise library.  With that said ,this is the simple example I'm following: <a href="http://zpalexander.com/blog/javascript-promises-node-js/" rel="nofollow">http://zpalexander.com/blog/javascript-promises-node-js/</a></p>

<p>This is the code that executes without error however as expected it logs "done" prior to finishing the file read and looping through the array.</p>

<pre><code>    var Promise = require('bluebird');
var Converter = Promise.promisifyAll(require("csvtojson")).Converter;
var converter = new Converter({});
var Client = Promise.promisifyAll(require('node-rest-client')).Client;
var client = new Client();
var responseArray = [];

converter.fromFile("./ToterFeed.csv", function(err,result){
    for (var i = 0, len = result.length; i &lt; len; i++) {
        var args = {
            data: JSON.stringify(result[i]),
            headers: { "Content-Type": "application/json" }
        };
        client.post("http://192.168.1.102:8080/api/ToterFeed/v1", args, function (data, response) {
            responseArray.push(data.responses);
            console.log(data.responses[0]);

        });


    }

})

console.log("done");
</code></pre>

<p>This is the updated code based on my interpretation.  I receive the "then is not a function" error.  </p>

<pre><code>  var Promise = require('bluebird');
var Converter = Promise.promisifyAll(require("csvtojson")).Converter;
var converter = new Converter({});
var Client = Promise.promisifyAll(require('node-rest-client')).Client;
var client = new Client();
var responseArray = [];

converter.fromFile("./ToterFeed.csv").then(function(err,result){
    for (var i = 0, len = result.length; i &lt; len; i++) {
        var args = {
            data: JSON.stringify(result[i]),
            headers: { "Content-Type": "application/json" }
        };
        client.post("http://192.168.1.102:8080/api/ToterFeed/v1", args, function (data, response) {
            responseArray.push(data.responses);
            console.log(data.responses[0]);
        });
    }

}).then(console.log("done"));
</code></pre>

<p>My goal is to run the fill read and array iteration to completion then print "done".  Any insights is much appreciated!  Thanks.</p>