aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2025-03-06 23:17:51 +0000
committerGitHub <noreply@github.com>2025-03-06 23:17:51 +0000
commit1472a05b1c0c6b59af974235d8462f757cf1b0d8 (patch)
tree2aa07ddcba76d083583c75ff0be86147425630e3 /src/config.rs
parentAdd CHANGELOG entry for #1431 (diff)
parentchange cli args (diff)
downloadminiserve-1472a05b1c0c6b59af974235d8462f757cf1b0d8.tar.gz
miniserve-1472a05b1c0c6b59af974235d8462f757cf1b0d8.zip
Merge pull request #1261 from Lzzzzzt/show-size-in-byte
Feature: Show size in byte
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index 4404959..379f7a7 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -158,6 +158,9 @@ pub struct MiniserveConfig {
/// If enabled, respond to WebDAV requests (read-only).
pub webdav_enabled: bool,
+ /// If enabled, will show in exact byte size of the file
+ pub show_exact_bytes: bool,
+
/// If set, use provided rustls config for TLS
#[cfg(feature = "tls")]
pub tls_rustls_config: Option<rustls::ServerConfig>,
@@ -278,6 +281,11 @@ impl MiniserveConfig {
.transpose()?
.unwrap_or_default();
+ let show_exact_bytes = match args.size_display {
+ crate::args::SizeDisplay::Human => false,
+ crate::args::SizeDisplay::Exact => true,
+ };
+
Ok(Self {
verbose: args.verbose,
path: args.path.unwrap_or_else(|| PathBuf::from(".")),
@@ -320,6 +328,7 @@ impl MiniserveConfig {
webdav_enabled: args.enable_webdav,
tls_rustls_config: tls_rustls_server_config,
compress_response: args.compress_response,
+ show_exact_bytes,
})
}
}