在nodejs中,给定一个字符串“foo-*”,如何找到所有以foo-开头的目录名称?
例如搜索将返回 foo-bar、foo-cheese 等。
到目前为止我所拥有的:
// If The directory name contains a wildcard character
// search all directory names with the preceding characters.
let wildcard = '*';
if (directory.indexOf(wildcard) !== -1) {
// Search for directories that contain the directory string (without the *).
}
我在文件系统模块中看不到任何有用的东西。
最佳答案
关于node.js - 如何在nodejs中查找与通配符匹配的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46251535/