How to use the walkdir.find function in walkdir

To help you get started, we’ve selected a few walkdir examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RetireJS / retire.js / node / lib / resolve.js View on Github external
function scanJsFiles(path) {
	var finder = walkdir.find(path);
	finder.on('file', function (file) {
		if (file.match(/\.js$/)) {
			finder.emit('jsfile', file);
		}
		if (file.match(/\/bower.json$/)) {
			finder.emit('bowerfile', file);
		}
	});
	return finder;
}
github yui / yogi / lib / util.js View on Github external
mods.tree = function(start, root, callback) {
    var finder = walkdir.find(start),
        tree = {};

    finder.on('path', function(file, stat) {
        var relativePath = path.relative(start, file),
            node = tree,
            parts = relativePath.split(path.sep);

        if (relativePath.indexOf('..') !== 0) {
            parts.forEach(function(part, key) {
                if (key < (parts.length - 1) || stat.isDirectory()) {
                    part += path.sep;
                }
                if (typeof node[part] !== 'object') {
                    node[part] = {};
                }
                node = node[part];
github yui / yogi / lib / cmds / serve.js View on Github external
scan: function(callback) {
        var finder = walkdir.find(process.cwd()),
            mods = [],
            self = this;

        finder.on('path', function(file, stat) {
            if (stat.isFile()) {
                var name = path.basename(file);
                if (name === 'build.json') {
                    mods.push(path.basename(path.dirname(file)));
                }
            }
        });

        finder.on('end', function() {
            if (mods.length) {
                log.info('using ' + mods.join(', '));
                self.module = {

walkdir

Find files simply. Walks a directory tree emitting events based on what it finds. Presents a familiar callback/emitter/a+sync interface. Walk a tree of any depth.

MIT
Latest version published 5 years ago

Package Health Score

73 / 100
Full package analysis