Metadata in async_std::fs - Rust (original) (raw)
pub struct Metadata { /* private fields */ }
Expand description
Returns the file type from this metadata.
§Examples
use async_std::fs;
let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.file_type());
Returns true
if this metadata is for a regular directory.
If this metadata is for a symbolic link, this method returns false
.
§Examples
use async_std::fs;
let metadata = fs::metadata(".").await?;
println!("{:?}", metadata.is_dir());
Returns true
if this metadata is for a regular file.
If this metadata is for a symbolic link, this method returns false
.
§Examples
use async_std::fs;
let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.is_file());
Returns the file size in bytes.
§Examples
use async_std::fs;
let metadata = fs::metadata("a.txt").await?;
println!("{}", metadata.len());
Returns the permissions from this metadata.
§Examples
use async_std::fs;
let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.permissions());
Returns the last modification time.
§Errors
This data may not be available on all platforms, in which case an error will be returned.
§Examples
use async_std::fs;
let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.modified());
Returns the last access time.
§Errors
This data may not be available on all platforms, in which case an error will be returned.
§Examples
use async_std::fs;
let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.accessed());
Returns the creation time.
§Errors
This data may not be available on all platforms, in which case an error will be returned.
§Examples
use async_std::fs;
let metadata = fs::metadata("a.txt").await?;
println!("{:?}", metadata.created());