如何查找与nodejs中的通配符匹配的任何目录?
问题描述:
在nodejs中,如果给定一个字符串“foo- *”,我如何才能找到以foo开头的所有目录名?如何查找与nodejs中的通配符匹配的任何目录?
E.g.搜索将返回FOO酒吧,FOO奶酪等
我有什么至今:
// 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 *).
}
我什么也看不见的文件系统模块中是有用的。
我去了glob模块。 – chap