serve-handler
serve-handler copied to clipboard
Add rendering of modified date in directory listing
This adds the modified date timestamp details.mtime to files. The timestamp gets rendered in directory listings. This is disabled by default but can be enabled by the new boolean option renderModifiedDate.
This is quite useful for a project that I'm working on where we serve lots of screenshots that are generated during end-to-end testing. Please let me know if additional changes are needed, I'd be happy to address any concerns.
In JSON response:
{
"files": [
{
"type": "directory",
"base": "..",
"relative": "/",
"title": "/",
"ext": ""
},
{
"root": "/",
"dir": "/home/moritz/dev/serve-handler/test/fixtures/single-directory",
"base": "content.txt",
"ext": "txt",
"name": "content",
"relative": "/single-directory/content.txt",
"type": "file",
"size": "19 B",
"mtime": "Fri, 25 Aug 2019 06:00:00 GMT",
"title": "content.txt"
}
],
}
In HTML Render:
