server/serve-statics.js
function scan(sp, cb) {
    cb = u.onceMaybe(cb);
    var timer = u.timer();
    sp.route = sp.route || '/';

    var src = sp.src;

    // only construct src, defaults, sendOpts etc. once
    if (!src) {
      sp.name = sp.name || 'staticPath:' + sp.path;
      sp.depth = sp.depth || opts.staticDepth || 5;
      sp.maxAge = 'maxAge' in sp ? sp.maxAge : '10m';
      sp.includeBinaries = true;
      src = sp.src = fsbase(sp);
      if (src.isfile()) { sp.depth = 1; }
      sp.sendOpts = u.assign(
        u.pick(sp, 'maxAge', 'lastModified', 'etag'),
        { dotfiles:'ignore',
          index:false,      // handled at this level
          extensions:false, // ditto
          root:src.path } );
    }

    src.listfiles(function(err, files) {
      if (err) return cb(log(err));
      sp.files = files;
      self.scanCnt++;
      mapAllFiles();
      debug('static scan %s-deep %sms %s', sp.depth, timer(), sp.path.replace(/.*\/node_modules\//g, ''));
      debug(files.length > 10 ? '[' + files.length + ' files]' : u.pluck(files, 'filepath'));
      cb();
    });
  }
function scan(sp, cb) {
    cb = u.onceMaybe(cb);
    var timer = u.timer();
    sp.route = sp.route || '/';

    var src = sp.src;

    // only construct src, defaults, sendOpts etc. once
    if (!src) {
      sp.name = sp.name || 'staticPath:' + sp.path;
      sp.depth = sp.depth || opts.staticDepth || 5;
      sp.maxAge = 'maxAge' in sp ? sp.maxAge : '10m';
      sp.includeBinaries = true;
      src = sp.src = fsbase(sp);
      if (src.isfile()) { sp.depth = 1; }
      sp.sendOpts = u.assign(
        u.pick(sp, 'maxAge', 'lastModified', 'etag'),
        { dotfiles:'ignore',
          index:false,      // handled at this level
          extensions:false, // ditto
          root:src.path } );
    }

    src.listfiles(function(err, files) {
      if (err) return cb(log(err));
      sp.files = files;
      self.scanCnt++;
      mapAllFiles();
      debug('static scan %s-deep %sms %s', sp.depth, timer(), sp.path.replace(/.*\/node_modules\//g, ''));
      debug(files.length > 10 ? '[' + files.length + ' files]' : u.pluck(files, 'filepath'));
      cb();
    });
  }
function scan ( sp , cb ) { cb = u . onceMaybe ( cb ) ; var timer = u . timer ( ) ; sp . route = sp . route || '/' ; var src = sp . src ; // only construct src, defaults, sendOpts etc. once if ( ! src ) { sp . name = sp . name || 'staticPath:' + sp . path ; sp . depth = sp . depth || opts . staticDepth || 5 ; sp . maxAge = 'maxAge' in sp ? sp . maxAge : '10m' ; sp . includeBinaries = true ; src = sp . src = fsbase ( sp ) ; if ( src . isfile ( ) ) { sp . depth = 1 ; } sp . sendOpts = u . assign ( u . pick ( sp , 'maxAge' , 'lastModified' , 'etag' ) , { dotfiles : 'ignore' , index : false , // handled at this level extensions : false , // ditto root : src . path } ) ; } src . listfiles ( function ( err , files ) { if ( err ) return cb ( log ( err ) ) ; sp . files = files ; self . scanCnt ++ ; mapAllFiles ( ) ; debug ( 'static scan %s-deep %sms %s' , sp . depth , timer ( ) , sp . path . replace ( / .*\/node_modules\/ / g , '' ) ) ; debug ( files . length > 10 ? '[' + files . length + ' files]' : u . pluck ( files , 'filepath' ) ) ; cb ( ) ; } ) ; }
repeatable scan for single staticPath
repeatable scan for single staticPath