The snippet below will iterate through the ./images directory and log all of the files found to the console. It uses the FileSystem module and is meant to be used with PhantomJS.

var fs = require('fs');

var dir = fs.workingDirectory + fs.separator + "images/";  
var images = fs.list(dir);

// loop through files and folders
for(var i = 0; i < images.length; i++) {  
    var imagePath = imageDirectory + images[i];
    if(fs.isFile(imagePath)) {
        console.log(imagePath);
    }
}

Documentation