title: Can I use Javascript to get a file directory list?
body: <p>I'm using client-side Javascript and want to get a list of all the files in a folder that I believe is hosted on the same server as my .html file. I'm very unfamiliar with the terminology so I apologize in advance if I'm inaccurate or just plain wrong.</p>
  
  <p>I currently use <code>d3.text("js/data/nodes#.csv", "text/csv", someFunction)</code> to load in a data file to work with. I figure that since all the filenames I want are templated the same way, I can hack a solution by looping through all possible numbers and only get the filenames of valid calls, like so:</p>
  
  <pre><code>function getDirList() {
      var possiblePathsList = something predetermined;
      var directoryList = [];
  
      possiblePathsList.forEach(function(path){
          if (isPath(path)) { directoryList.push(path); }
      });
  
      return directoryList;
  }
  
  function isPath(path){
      d3.text(path, "text/csv", function(data){   
          return (data !== null);
      });
  }
  </code></pre>
  
  <p>Because I can get a list in this very rubbish way, I presume there must be some (much, much more) elegant method of achieving my goal. Is this possible?</p>