From d7c93fe195f205d42ad8688aafde4caf86504a87 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 11 Dec 2010 23:47:03 -0700 Subject: [PATCH] example of walk3 --- examples/find.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/find.js diff --git a/examples/find.js b/examples/find.js new file mode 100644 index 0000000..82d1d79 --- /dev/null +++ b/examples/find.js @@ -0,0 +1,23 @@ +(function () { + var walk = require("../lib/walk3.js"), + emit = walk(process.argv[2] || "/tmp"); + //icount = 0; + + emit.on('directory', function (path, file, next) { + //icount += 1; + console.log(path + '/' + file.name); // + " " + icount); + process.nextTick(next); + //setTimeout(next, 100); + }); + /* + emit.on('file', function (path, file, next) { + console.log("FILE:", file.name, "\n"); + next(); + }); + emit.on('directory', function (path, dir, next) { + console.log("DIR:", dir.name, "\n"); + next(); + }); + */ +}()); +