directory entries show created at date

This commit is contained in:
2025-07-16 04:14:26 +02:00
parent ee6a1bc25c
commit a683f44ecb
5 changed files with 41 additions and 11 deletions

View File

@@ -1,3 +1,5 @@
use std::time::UNIX_EPOCH;
use anyhow::{Context, anyhow};
use tokio::{fs, io::AsyncWriteExt as _};
@@ -67,13 +69,20 @@ impl FileSystem {
continue;
}
};
let metadata = entry.metadata().await?;
let created_at = metadata.created()?.duration_since(UNIX_EPOCH)?.as_secs();
let mime_type = match file_type {
FileType::File => FileMimeType::from_name(&name),
_ => None,
};
files.push(File::new(FileName::new(&name)?, file_type, mime_type));
files.push(File::new(
FileName::new(&name)?,
file_type,
mime_type,
created_at,
));
}
Ok(files)