* +files+ An Array of file paths
 Returns an Array of SH2 digests for each of the given files
353117
def digest_sha2(*files)
      files.flatten.collect { |file| 
        File.exists?(file) ? Digest::SHA2.hexdigest(File.read(file)) : nil
      }
    end
1223640
function getFileList(dir, sort = true) {
    return new Promise((resolve, reject) => {
        readdir(dir, (error, files) => {
            if (error) {
                reject(error);
                return;
            }
            let resultantFilesList;

            if (sort) {
                const stripLength = (dir.substr(0, 2) === './') ? dir.length - 1 : dir.length + 1;
                let pathsUnified = files.map((pth => pth.substr(stripLength).replace(/[\\/]/gm, '-')));
                const temporaryIndex = {};
                files.forEach((file, i) => {
                    temporaryIndex[pathsUnified[i]] = file;
                });
                pathsUnified = pathsUnified.sort();
                const filesSorted = [];
                pathsUnified.forEach((key) => {
                    filesSorted.push(temporaryIndex[key]);
                });

                resultantFilesList = filesSorted;
            } else {
                resultantFilesList = files;
            }
            resolve(resultantFilesList);
        });
    });
}
975062
def files_in(directories)
      files = []
      Find.find(*directories) do |path|
        unless File.directory?(path) or File.symlink?(path)
          files << File.expand_path(path)
        end
      end
      files.uniq
    end
886536
def hashify_files(files: list) -> dict:
    """"""
    return {filepath.replace('\\', '/'): hash_tree(filepath)
            for filepath in listify(files)}
752231
function explode ( filepaths ) {
		var json, res = [];
		filepaths.filter ( existence ).forEach ( function ( filepath ) {
			switch ( path.extname ( filepath )) {
				case ".json" :
					json = grunt.file.readJSON ( filepath );
					res.push.apply ( res, json.map ( function ( localpath ) {
						return path.dirname ( filepath ) + "/" + localpath;
					}));
					break;
				case ".js" :
					res.push ( filepath );
					break;
			}
		});
		return res;
	}
734206
def get_files(path:PathOrStr, extensions:Collection[str]=None, recurse:bool=False,
              include:Optional[Collection[str]]=None)->FilePathList:
    ""
    if recurse:
        res = []
        for i,(p,d,f) in enumerate(os.walk(path)):
            # skip hidden dirs
            if include is not None and i==0:  d[:] = [o for o in d if o in include]
            else:                             d[:] = [o for o in d if not o.startswith('.')]
            res += _get_files(path, p, f, extensions)
        return res
    else:
        f = [o.name for o in os.scandir(path) if o.is_file()]
        return _get_files(path, path, f, extensions)
454376
def list_files(path = Dir.pwd)
      g = MiniGit.new(path)
      g.capturing.ls_files.split
    end
547964
def hashes_get(versions_file, base_path):
    
    files = versions_file.files_get_all()
    result = {}
    for f in files:
        try:
            result[f] = functions.md5_file(base_path + f)
        except IOError:
            # Not all files exist for all versions.
            pass

    return result
1754
def digest_dirname(file_path)
      slash_path(File.dirname(file_path)).sub(slash_path(self.source.path), '')
    end
128282
private static function retrieveFilesFromPaths(array $paths): iterable
    {
        if ([] === $paths) {
            return [];
        }

        $pathsToSearch = [];
        $filesToAppend = [];

        foreach ($paths as $path) {
            if (false === file_exists($path)) {
                throw new RuntimeException(
                    sprintf(
                        'Could not find the file "%s".',
                        $path
                    )
                );
            }

            if (is_dir($path)) {
                $pathsToSearch[] = $path;
            } else {
                $filesToAppend[] = $path;
            }
        }

        $finder = new Finder();

        $finder->files()
            ->in($pathsToSearch)
            ->append($filesToAppend)
            ->filter(static function (SplFileInfo $fileInfo): ?bool {
                if ($fileInfo->isLink()) {
                    return false;
                }

                return null;
            })
            ->sortByName()
        ;

        return $finder;
    }
538528
function _getFiles(path){
        let files = [];
        fs.readdirSync(path).forEach(function(file){
            let subpath = path + '/' + file;
            if(fs.lstatSync(subpath).isDirectory()){
                let filesReturned = _getFiles(subpath);
                files = files.concat(filesReturned);
            } else {
                files.push(path + '/' + file);
            }
        });
        return files;
    }
1330537
function(paths) {

        var appends = [];

        if (grunt.option("quiet") || config.quiet) {
            appends.push("--quiet");
        }

        if (grunt.option("verbose") || config.verbose) {
            appends.push("--verbose");
        }

        if (grunt.option("rules") || config.rules) {
            var rules = _.isString(config.rules) ? config.rules.split(",") : config.rules;
            appends.push("--rules=" + rules.join(","));
        }

        if (grunt.option("dryRun") || config.dryRun) {
            appends.push("--dry-run");
        }

        if (grunt.option("diff") || config.diff) {
            appends.push("--diff");
        }

        if (grunt.option("allowRisky") || config.allowRisky) {
            appends.push("--allow-risky yes");
        }

        if (grunt.option("usingCache") || config.usingCache) {
            appends.push("--using-cache " + config.usingCache);
        }

        if (grunt.option("configfile") || config.configfile) {
            appends.push("--config=" + config.configfile);
        }

        var bin = path.normalize(config.bin),
            append = appends.join(" "),
            cmds = [];

        if (paths.length) {
            cmds = _.map(paths, function(thePath) {
                return bin + " fix " + thePath + " " + append;
            });
        }

        if (grunt.option("configfile") || config.configfile) {
            cmds.push(bin + " fix " + append);
        }

        return cmds;
    }
1068865
def each_file(&bl)
      unpack do |dir|
        Pathname.new(dir).find do |path|
          next if path.to_s == dir.to_s
          pathstr = path.to_s.gsub("#{dir}/", '')
          bl.call pathstr unless pathstr.blank?
        end
      end
    end
1317790
function exec(paths, options) {
    ls.self = this;
    paths = paths !== null && !Array.isArray(paths) && (typeof paths === 'undefined' ? 'undefined' : _typeof(paths)) === 'object' ? paths.paths : paths;
    paths = paths || ['.'];
    paths = Array.isArray(paths) ? paths : [paths];
    paths = expand(paths);

    options = options || {};

    var preSortedPaths = ls.preSortPaths(paths);

    var dirResults = [];
    for (var i = 0; i < preSortedPaths.dirs.length; ++i) {
      if (options.recursive) {
        var result = ls.execDirRecursive(preSortedPaths.dirs[i], options);
        dirResults = dirResults.concat(result);
      } else {
        dirResults.push(ls.execDir(preSortedPaths.dirs[i], options));
      }
    }

    var stdout = '';
    if (preSortedPaths.files.length > 0) {
      stdout += ls.execLsOnFiles('.', preSortedPaths.files, options).results;
    }

    var dirOutput = ls.formatAll(dirResults, options, dirResults.length + preSortedPaths.files.length > 1);
    stdout += stdout && dirOutput ? '\n\n' + dirOutput : dirOutput;
    if (strip(stdout).trim() !== '') {
      ls.self.log(String(stdout).replace(/\\/g, '/'));
    }

    return 0;
  }
52809
function (srcFiles, destPath) {
    // Iterate over all specified file groups.
    srcFiles.map(grunt.file.read).forEach(function (fileContent, i) {
        var abspath = srcFiles[i];
        var results = fileContent.match(applyminGlobal.beginminPattern_global);
        if (results) {
            var beginminInfo = {};
            for (var index in results) {
                var result = results[index].match(applyminGlobal.beginminPattern);
                var beginEndMinBlock = result[0];
                var targetUrlPath = result[1];
                var staticBlock = result[2];  // static block, maybe css/js
                var targetFilePath = targetUrlPath.match(new RegExp(destPath + '/' + '\\S+\\.(css|js)', 'i'));
                if (!targetFilePath) {
                    grunt.warn('In the file: ' + abspath + ', the target filename in ' + targetUrlPath + ' should start with ' + destPath + '/' + ' and end with .css or .js');
                }
                targetFilePath = targetFilePath[0];
                _handleStaticBlock(abspath, targetFilePath, staticBlock);
                if (targetFilePath in beginminInfo) {
                    grunt.warn('In the file: ' + abspath + ', the target filename ' + targetFilePath + ' should not be duplicated.');
                }
                beginminInfo[targetFilePath] = {targetUrlPath:targetUrlPath, beginEndMinBlock:beginEndMinBlock};
            }
            // Store results for the applymin later.
            applyminGlobal.beginminInfos[abspath] = beginminInfo;
        }
    });
  }
1269622
def file_list( files )
    case files
    when String
      [files]
    when Array
      files
    when Proc
      files.call # result should respond to #each
    else
      []
    end
  end
1100518
function expandFiles(files, basePath) {
    var expandedFiles = [];
    files = files ? _.isArray(files) ? files : [files] : [];

    _.forEach(files, function(fileName) {
        expandedFiles = _.union(
            expandedFiles,
            glob.sync(path.join(basePath, fileName), { dot: true, nodir: true })
        );
    });

    return expandedFiles;
}