Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Parse thttpd index pages
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
LICENSE.md
README.md
index.js
package.json

README.md

thttpd-index-parser

Parse thttpd index pages

Overview

There's really not much to say. thttpd provides a stable, if ugly, autoindex page. I have reason to parse this page. The rest is history.

Installation

$ npm install thttpd-index-parser

OR

$ git clone git://github.com/deoxxa/thttpd-index-parser.git node_modules/thttpd-index-parser

Usage

This is about it. There's not much to know.

#!/usr/bin/env node

var parser = require("thttpd-index-parser"),
    request = require("request");

request("http://somewhere/with/a/list", function(err, res, data) {
  console.log(parser.parse(data.toString()));
});

parser.parse returns an array of objects, one for each entry in the list. The structure of those objects is as follows.

A file:

{
  "url": "http://a.fully.qualified.domain/and/the/whole/path",
  "time": new Date("Sun Sep 16 2012 00:33:35 GMT+1000 (EST)"),
  "size": 12345,
}

A directory:

{
  "url": "http://same.as.above/but/the/path/ends/in/a/slash/",
  "time": new Date("Sun Sep 16 2012 00:33:35 GMT+1000 (EST)"),
  "size": null,
}

License

3-clause BSD. A copy is included with the source.

Contact

Something went wrong with that request. Please try again.