index.js
function html(files, dir, useIcons, view, req) {
  return '<ul id="files" class="view-' + escapeHtml(view) + '">'
    + (view == 'details' ? (
      '<li class="header">'
      + '<span class="name">Name</span>'
      + '<span class="size">Size</span>'
      + '<span class="date">Modified</span>'
      + '</li>') : '')
    + files.map(function(file){
    var isDir = '..' == file.name || (file.stat && file.stat.isDirectory())
      , classes = []
      , path = dir.split('/').map(function (c) { return encodeURIComponent(c); });

    if (useIcons) {
      classes.push('icon');

      if (isDir) {
        classes.push('icon-directory');
      } else {
        var ext = extname(file.name);
        var icon = iconLookup(file.name);

        classes.push('icon');
        classes.push('icon-' + ext.substring(1));

        if (classes.indexOf(icon.className) === -1) {
          classes.push(icon.className);
        }
      }
    }

    path.push(encodeURIComponent(file.name));

    var date = file.stat && file.name !== '..'
      ? file.stat.mtime.toDateString() + ' ' + file.stat.mtime.toLocaleTimeString()
      : '';
    var size = file.stat && !isDir
      ? file.stat.size
      : '';

    return '<li><a href="'
      + escapeHtml(normalizeSlashes(normalize(req.prefixPath + path.join('/'))))
      + '" class="' + escapeHtml(classes.join(' ')) + '"'
      + ' title="' + escapeHtml(file.name) + '">'
      + '<span class="name">' + escapeHtml(file.name) + '</span>'
      + '<span class="size">' + escapeHtml(size) + '</span>'
      + '<span class="date">' + escapeHtml(date) + '</span>'
      + '</a></li>';

  }).join('\n') + '</ul>';
}
function html(files, dir, useIcons, view, req) {
  return '<ul id="files" class="view-' + escapeHtml(view) + '">'
    + (view == 'details' ? (
      '<li class="header">'
      + '<span class="name">Name</span>'
      + '<span class="size">Size</span>'
      + '<span class="date">Modified</span>'
      + '</li>') : '')
    + files.map(function(file){
    var isDir = '..' == file.name || (file.stat && file.stat.isDirectory())
      , classes = []
      , path = dir.split('/').map(function (c) { return encodeURIComponent(c); });

    if (useIcons) {
      classes.push('icon');

      if (isDir) {
        classes.push('icon-directory');
      } else {
        var ext = extname(file.name);
        var icon = iconLookup(file.name);

        classes.push('icon');
        classes.push('icon-' + ext.substring(1));

        if (classes.indexOf(icon.className) === -1) {
          classes.push(icon.className);
        }
      }
    }

    path.push(encodeURIComponent(file.name));

    var date = file.stat && file.name !== '..'
      ? file.stat.mtime.toDateString() + ' ' + file.stat.mtime.toLocaleTimeString()
      : '';
    var size = file.stat && !isDir
      ? file.stat.size
      : '';

    return '<li><a href="'
      + escapeHtml(normalizeSlashes(normalize(req.prefixPath + path.join('/'))))
      + '" class="' + escapeHtml(classes.join(' ')) + '"'
      + ' title="' + escapeHtml(file.name) + '">'
      + '<span class="name">' + escapeHtml(file.name) + '</span>'
      + '<span class="size">' + escapeHtml(size) + '</span>'
      + '<span class="date">' + escapeHtml(date) + '</span>'
      + '</a></li>';

  }).join('\n') + '</ul>';
}
function html ( files , dir , useIcons , view , req ) { return '<ul id="files" class="view-' + escapeHtml ( view ) + '">' + ( view == 'details' ? ( '<li class="header">' + '<span class="name">Name</span>' + '<span class="size">Size</span>' + '<span class="date">Modified</span>' + '</li>' ) : '' ) + files . map ( function ( file ) { var isDir = '..' == file . name || ( file . stat && file . stat . isDirectory ( ) ) , classes = [ ] , path = dir . split ( '/' ) . map ( function ( c ) { return encodeURIComponent ( c ) ; } ) ; if ( useIcons ) { classes . push ( 'icon' ) ; if ( isDir ) { classes . push ( 'icon-directory' ) ; } else { var ext = extname ( file . name ) ; var icon = iconLookup ( file . name ) ; classes . push ( 'icon' ) ; classes . push ( 'icon-' + ext . substring ( 1 ) ) ; if ( classes . indexOf ( icon . className ) === - 1 ) { classes . push ( icon . className ) ; } } } path . push ( encodeURIComponent ( file . name ) ) ; var date = file . stat && file . name !== '..' ? file . stat . mtime . toDateString ( ) + ' ' + file . stat . mtime . toLocaleTimeString ( ) : '' ; var size = file . stat && ! isDir ? file . stat . size : '' ; return '<li><a href="' + escapeHtml ( normalizeSlashes ( normalize ( req . prefixPath + path . join ( '/' ) ) ) ) + '" class="' + escapeHtml ( classes . join ( ' ' ) ) + '"' + ' title="' + escapeHtml ( file . name ) + '">' + '<span class="name">' + escapeHtml ( file . name ) + '</span>' + '<span class="size">' + escapeHtml ( size ) + '</span>' + '<span class="date">' + escapeHtml ( date ) + '</span>' + '</a></li>' ; } ) . join ( '\n' ) + '</ul>' ; }
Map html `files`, returning an html unordered list.
Map html files returning an html unordered list .