Recursive file walking / copying for node with middleware

npm install walkr
43 downloads in the last day
95 downloads in the last week
651 downloads in the last month

Recursive file walking / copying for node.js with middleware


  • Ability to filter files & directories.
  • Inspired by dryice, findit.

Copyr Example:

var walkFiles = require('walkr'),
fs            = require('fs'),
mu            = require('mu'),
tplData       = {};

walkFiles(source, destination).
filter(/^\./). //no hidden files AND dirs
filterDir(/node_modules/). //no node_modules dir
filterFile(function(options, next) {

    //template file? parse it, and copy it.
    if(options.source.match(/.tpl.html/)) {

        //after write file, call next. SINCE parameters are given, walkr assumes files were written, so it does
        //not continue.
        var tpl = mu.to_html(fs.readFileSync(options.source, "utf8"), tplData);
        return fs.writeFile(options.destination, tpl, next);


    //call next without parameters 
    return next();
start(function(err) {


Walkr Example:

var walkFiles = require('walkr');

on('directory', function(ops) {
on('file', function(ops) {
start(function(err) {

npm loves you