npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

apache-autoindex-parse

v5.0.2

Published

parse apache's autoindex html files

Readme

apache-autoindex-parse

npm version npm downloads

a simple apache autoindex parser

📦 Installation

npm install apache-autoindex-parse

🚀 Usage

import { parse } from "apache-autoindex-parse";

const html = `<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
  <head>
    <title>Index of /Public/emoji</title>
  </head>
  <body>
    <div style="padding: 0.5em">
      <!-- this is /file-header.html - it is a HeaderName for the /Public and other dirs -->

      © 1991-Present Unicode, Inc. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S.
      and other countries. All the contents of this directory are governed by the
      <a href="https://www.unicode.org/copyright.html">Terms of Use</a>.
    </div>

    <hr />
    <table>
      <tr>
        <th valign="top"><img src="/icons/blank.gif" alt="[ICO]" /></th>
        <th><a href="?C=N;O=D;F=2">Name</a></th>
        <th><a href="?C=M;O=A;F=2">Last modified</a></th>
        <th><a href="?C=S;O=A;F=2">Size</a></th>
        <th><a href="?C=D;O=A;F=2">Description</a></th>
      </tr>
      <tr>
        <th colspan="5"><hr /></th>
      </tr>
      <tr>
        <td valign="top"><img src="/icons/back.gif" alt="[PARENTDIR]" /></td>
        <td><a href="/Public/">Parent Directory</a></td>
        <td>&nbsp;</td>
        <td align="right">-</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><img src="/icons/folder.gif" alt="[DIR]" /></td>
        <td><a href="1.0/">1.0/</a></td>
        <td align="right">2015-05-26 18:40</td>
        <td align="right">-</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><img src="/icons/text.gif" alt="[TXT]" /></td>
        <td><a href="ReadMe.txt">ReadMe.txt</a></td>
        <td align="right">2025-02-19 16:36</td>
        <td align="right">588</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <th colspan="5"><hr /></th>
      </tr>
    </table>
  </body>
</html>`;

// Format can be either "F0", "F1" or "F2"
const format = "F2";

// If you leave the format empty, it will try and auto-infer it.
// If it can't infer it, it will default to "F0"
const entries = parse(html, format);

console.log(entries);
// [
//   {
//     type: 'directory',
//     name: '1.0',
//     path: '1.0',
//     lastModified: 1432658400000
//   },
//   {
//     type: 'file',
//     name: 'ReadMe.txt',
//     path: 'ReadMe.txt',
//     lastModified: 1739979360000
//   }
// ]

// You can also use the options object to customize the output
const entriesWithBasePath = parse(html, {
  format: "F2",
  basePath: "/cdn/unicode/public"
});

console.log(entriesWithBasePath);
// [
//   {
//     type: 'directory',
//     name: '1.0',
//     path: '/cdn/unicode/public/1.0',
//     lastModified: 1432658400000
//   },
//   {
//     type: 'file',
//     name: 'ReadMe.txt',
//     path: '/cdn/unicode/public/ReadMe.txt',
//     lastModified: 1739979360000
//   }
// ]

[!NOTE] If you want to traverse an entire apache, you can utilize the traverse function which is being exported from apache-autoindex-parse/traverse.

Customizing Paths

You can customize the output paths by providing a basePath option. This is useful when you want to map the parsed entries to a different location:

import { parse } from "apache-autoindex-parse";

const html = await fetch("https://www.unicode.org/Public/emoji/").then((res) => res.text());

// Prepend a base path to all entries
const entries = parse(html, {
  basePath: "/cdn/unicode/emoji"
});

// All paths will now start with /cdn/unicode/emoji/
console.log(entries[0].path); // e.g., "/cdn/unicode/emoji/1.0"

The basePath option is also available in the traverse function:

import { traverse } from "apache-autoindex-parse/traverse";

const result = await traverse("https://www.unicode.org/Public/emoji/", {
  basePath: "/cdn/unicode",
  onFile: (file) => {
    console.log(file.path); // e.g., "/cdn/unicode/1.0/ReadMe.txt"
  }
});

📄 License

Published under MIT License.