rest icon indicating copy to clipboard operation
rest copied to clipboard

custom directory-listing mode for FileServer

Open umputun opened this issue 4 years ago • 0 comments

With #18 in place, one of the new options allows directory listing. Unfortunately, the one from stdlib is as ugly as hell and not customizable at all. It would be very nice to add the ability to make this list somewhat custom. Ideally, it should support some template with {{.Name}} {{.Size}} {{.DateTime}} and so on.

I don't see a direct way to achieve it and can think of a couple of hacks:

  1. Define a custom response writer to intercept and replace the standard list of files. Very unclear how to even detect the list output, how to eliminate dbl/read, and so on
  2. Implement our own http.File / http.Dir on top of stdlib. Also a lot of questions here and potential issues.
  3. something else?

umputun avatar Aug 23 '21 05:08 umputun