allow providing a directory, mark as file or directory
This commit is contained in:
		
							parent
							
								
									908051c694
								
							
						
					
					
						commit
						754f6bb9c4
					
				| @ -2,13 +2,24 @@ | |||||||
|   "use strict"; |   "use strict"; | ||||||
| 
 | 
 | ||||||
|   var walk = require('../lib/walk').walk |   var walk = require('../lib/walk').walk | ||||||
|  |     , path = require('path') | ||||||
|  |     , dirname = process.argv[2] || './' | ||||||
|     , walker |     , walker | ||||||
|     ; |     ; | ||||||
| 
 | 
 | ||||||
|   walker = walk('./'); |   walker = walk(dirname); | ||||||
|   walker.on('file', function (root, stat, next) { | 
 | ||||||
|     console.log(root, stat.name); |   walker.on('directory', function (root, stat, next) { | ||||||
|  |     console.log('[d]', path.join(root, stat.name)); | ||||||
|     next(); |     next(); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|  |   walker.on('file', function (root, stat, next) { | ||||||
|  |     console.log('[f]', path.join(root, stat.name)); | ||||||
|  |     next(); | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   walker.on('end', function () { | ||||||
|  |     console.log('All Done!'); | ||||||
|  |   }); | ||||||
| }()); | }()); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user