code: function onDirectory() {
        var this_SendStream = this;
        if (!/\/$/.test(reqUrl.pathname)) {
          // No trailing slash? Redirect to add one
          res.writeHead(301, {
            'Location': reqUrl.pathname + '/' + (reqUrl.search || '')
          });
          res.end();
          deferred.resolve(true);
          return;
        }
  
        var indexPath = path.normalize(path.join(
          self.$root, unescape(this.path), 'index.html'));
  
        fs.exists(indexPath, function(exists) {
          if (exists) {
            // index.html exists, just serve that. This is the same as
            // the below call except without onDirectory and without
            // .index(false)
            send(req, suffix, {root: self.$root})
              .on('error', onError)
              .on('stream', onStream)
              .pipe(res);
            deferred.resolve(true);
          } else {
            // Either serve up 404, or the directory auto-index
            if (!self.$dirIndex) {
              deferred.resolve(null);
            } else {
              deferred.resolve(
                self.$autoindex_p(req, res, this_SendStream.path, self.$blacklist)
              );
            }
          }
        });
      }
docs: Called when the URL requested is a directory