+
+
+
Name
+
Date modified
+
Size
+
+ +
+ ` + + if (requestPath !== '/' && requestPath !== '') { + const parentPath = path.dirname(requestPath) + html += ` + +
+ + + + +
+
.. (Up to parent directory)
+
+
+
+ ` + } + + if (sortedFiles.length === 0) { + html += ` +
+ + + +
This folder is empty
+
+ ` + } else { + sortedFiles.forEach((fileInfo: any) => { + const filePath = path.join(requestPath, fileInfo.name) + const icon = getFileIcon(fileInfo.name, fileInfo.isDirectory) + const sizeDisplay = fileInfo.isDirectory ? '' : formatFileSize(fileInfo.size || 0) + const modifiedDate = fileInfo.mtime + ? new Date(fileInfo.mtime).toLocaleDateString('en-US', { + year: '2-digit', + month: 'numeric', + day: 'numeric' + }) + + ' ' + + new Date(fileInfo.mtime).toLocaleTimeString('en-US', { + hour: 'numeric', + minute: '2-digit', + hour12: true + }) + : '' + + html += ` + +
${icon}
+
${fileInfo.name}
+
${modifiedDate}
+
${sizeDisplay}
+
+ ` + }) + } + + const itemCount = sortedFiles.length + (requestPath !== '/' && requestPath !== '' ? 1 : 0) + + html += ` +
+
+