diff --git a/example.mjs b/example.mjs index 2c3bd33..9816e4b 100644 --- a/example.mjs +++ b/example.mjs @@ -10,4 +10,4 @@ const filemanager = new Livefiles({ }) await filemanager.ready() -await filemanager.close() +await filemanager.close() \ No newline at end of file diff --git a/index.js b/index.js index 9822fc1..61cd85e 100644 --- a/index.js +++ b/index.js @@ -245,8 +245,8 @@ class Livefiles extends ReadyResource { const filePath = path.join(urlPath, file.name) const safeFileName = this.escapeHtml(file.name) const iconHtml = file.isDirectory() - ? '' - : '' + ? '' + : '' const downloadButton = file.isDirectory() ? `Enter` @@ -255,15 +255,13 @@ class Livefiles extends ReadyResource { // Get file or folder size (optimized) let size if (file.isDirectory()) { - // For directories, calculate size asynchronously - const dirSize = await this.calculateDirectorySize(path.join(fullPath, file.name)) - size = this.formatBytes(dirSize) + size = '' } else { const stats = await stat(path.join(fullPath, file.name)) size = this.formatBytes(stats.size) } - return `${iconHtml}${safeFileName}${downloadButton}${size}` + return `${iconHtml}${safeFileName}

${size}

${downloadButton}` } catch { return null // Skip if not readable } @@ -291,7 +289,7 @@ class Livefiles extends ReadyResource {
- +
@@ -312,27 +310,33 @@ class Livefiles extends ReadyResource { Directory Listing | Filemanager