nl_tokens: Get files from the dir filtered with pattern
pl_tokens: function getFiles ( dir , pattern , fn ) { if ( "function" === typeof pattern ) { fn = pattern ; pattern = undefined ; } pattern = <mask> || / .* / ig ; fs . readdir ( dir , function ( err , files ) { if ( err ) return fn && fn ( err ) ; async . map ( files , function ( f , cb ) { fs . stat ( path . join ( dir , f ) , function ( err , stats ) { if ( err ) return cb && cb ( err ) ; cb && cb ( null , { filename : f , stats : stats } ) } ) } , function ( err , stats ) { if ( err ) return fn && fn ( err ) ; var fstats = stats . filter ( function ( f ) { return f . stats . isFile ( ) && pattern . test ( f . filename ) ; } ) ; fn && fn ( null , fstats ) ; } ) ; } ) ; }