How to use the filer.path.dirname function in filer

To help you get started, we’ve selected a few filer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github humphd / nohost / src / html-formatter.js View on Github external
function formatDir(route, dirPath, entries) {
  const parent = path.dirname(dirPath) || '/';
  // Maintain path sep, but deal with things like spaces in filenames
  const url = encodeURI(route + parent);
  const header = `
    
    <title>Index of ${dirPath}</title>
    <h1>Index of ${dirPath}</h1>
    `;
  const footer = `<table><tbody><tr><th><img alt="[ICO]" src="${blank}"></th>
    <th><b>Name</b></th><th><b>Last modified</b></th>
    <th><b>Size</b></th><th><b>Description</b></th></tr>
    <tr><th colspan="5"><hr></th></tr>
    <tr><td valign="top"><img alt="[DIR]" src="${back}"></td>
    <td><a href="${url}">Parent Directory</a></td><td>&nbsp;</td>
    <td align="right">  - </td><td>&nbsp;</td></tr><tr><th colspan="5"><hr></th></tr></tbody></table>${footerClose}`;

  const rows = entries.map(entry =&gt; {