matchfiles
0.0.6 • Public • Published 一个简单文件匹配实现
Examples
最简单的完全匹配
var matchFiles = require('../lib/match-files')
var stream = matchFiles('../lib','path-matcher.js')
stream.on('file',function(abs,filename,extname,$){
console.log(filename)
})
单星号匹配
var matchFiles = require('../lib/match-files')
var stream = matchFiles('../lib','*.js')
stream.on('file',function(abs,filename,extname,$){
console.log(filename)
})
双星号匹配
var matchFiles = require('../lib/match-files')
var stream = matchFiles('../../','match-files/**/treestream.js')
stream.on('file',function(abs,filename,extname,$){
console.log(filename)
})
API
constructor
MatchFiles(searchDir,include,exclude)
searchDir
{String} 搜索的起始路径,可以是绝对路径或者相对路径
include
{String | Array} 要搜索的文件
exclude
{String | Array} 要排除的文件
事件
file
回调函数中 abs,filename,extname,$
分别表示匹配到的文件的绝对路径,文件名,后缀名,匹配到的*
或**
数组
end
用途
Readme
Keywords
nonePackage Sidebar
Install
Weekly Downloads