lib/index.js
function listXmlFiles(path, recursive) {
  try {
    var allFiles = recursive ? read(path) : fs.readdirSync(path);

    var xmlFiles = allFiles
      .map(function(file) {
        return fspath.join(path, file);
      })
      // Fiter out non-files
      .filter(function(file) {
        return fs.statSync(file).isFile();
      })
      // Only return files ending in '.xml'
      .filter(function(file) {
        return file.slice(-4) === ".xml";
      });
    // No files returned
    if (!xmlFiles.length > 0) {
      return new Error("No xml files found");
    } else {
      // Return the array of files ending in '.xml'
      return xmlFiles;
    }
  } catch (e) {
    throw e;
  }
}
function listXmlFiles(path, recursive) {
  try {
    var allFiles = recursive ? read(path) : fs.readdirSync(path);

    var xmlFiles = allFiles
      .map(function(file) {
        return fspath.join(path, file);
      })
      // Fiter out non-files
      .filter(function(file) {
        return fs.statSync(file).isFile();
      })
      // Only return files ending in '.xml'
      .filter(function(file) {
        return file.slice(-4) === ".xml";
      });
    // No files returned
    if (!xmlFiles.length > 0) {
      return new Error("No xml files found");
    } else {
      // Return the array of files ending in '.xml'
      return xmlFiles;
    }
  } catch (e) {
    throw e;
  }
}
function listXmlFiles ( path , recursive ) { try { var allFiles = recursive ? read ( path ) : fs . readdirSync ( path ) ; var xmlFiles = allFiles . map ( function ( file ) { return fspath . join ( path , file ) ; } ) // Fiter out non-files . filter ( function ( file ) { return fs . statSync ( file ) . isFile ( ) ; } ) // Only return files ending in '.xml' . filter ( function ( file ) { return file . slice ( - 4 ) === ".xml" ; } ) ; // No files returned if ( ! xmlFiles . length > 0 ) { return new Error ( "No xml files found" ) ; } else { // Return the array of files ending in '.xml' return xmlFiles ; } } catch ( e ) { throw e ; } }
List all XML files in directory
@param {*} path
@param {*} recursive
List all XML files in directory