file_info

Crates.iofile_info
lib.rsfile_info
version0.1.3
sourcesrc
created_at2024-11-18 11:39:40.340363
updated_at2024-11-21 01:11:26.230542
descriptionA Rust program that inspects a file and prints its metadata including file size and type.
homepage
repository
max_upload_size
id1452117
size3,326
Ben Santora (bensatlantik)

documentation

README

file_info

Overview

This program demonstrates how to inspect file metadata using the Rust standard library. It reads the metadata of a specified file and prints details such as the file size and type.

How It Works

The program uses the fs::metadata function to get metadata information about the specified file. It checks if the given path is a regular file, a directory, or another type. It prints the file size (in bytes) and its type to the terminal.

Running the Program

Ensure Rust is installed on your system. You can download it from rust-lang.org.

Setup

Clone the repository:

git clone <repository-url>
cd file_info

Create a file named example.txt in the project directory or modify the filename in the code to match an existing file. Build and run the program:

cargo run

Expected Output

If the file example.txt exists, you'll see output similar to:

File Size: 123 bytes
File Type: Regular File

Notes

This program is designed to be run in the terminal. It currently works on Unix-based systems due to its use of MetadataExt from std::os::unix.

License

This project is licensed under the MIT License

Author

bensatlantik

Commit count: 0

cargo fmt