GitHub user rick-200 added a comment to the discussion: Is there a way to tell
if the file size is 0 or if the service doesn't provide size?
Thank you for your reply!
However, when using the **`list`** operation, some services, such as `Fs`, do
not provide the file size. For example, the following code `content_length`
returns 0 for of all files.
Is `Fs` the only one who get this behavior? I understand this is due to the
fact that `readdir` on unix systems only returns the filename, so extra `stat`
is needed.
It does feel like there could be some confusion here, if the program relies on
the file size returned by the `list` operation, this is unreliable due to the
presence of `Fs`, and if the program performs the extra `stat` used to get the
size, it's wasteful.
```rust
use opendal::{services, Operator};
#[tokio::main]
async fn main() {
let op =
Operator::new(services::Fs::default().root("D:/")).unwrap().finish();
let entries = op.list_with("").await.unwrap();
for entry in entries {
println!("{} {}", entry.path(), entry.metadata().content_length());
}
}
```
GitHub link:
https://github.com/apache/opendal/discussions/6323#discussioncomment-13536842
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]