#file #inode #read-file #index #system #unique-id

bin+lib file-id

Utility for reading inode numbers (Linux, MacOS) and file IDs (Windows)

4 releases

0.2.2 Oct 25, 2024
0.2.1 Aug 21, 2023
0.2.0 Aug 20, 2023
0.1.0 May 17, 2023

#551 in Filesystem

Download history 38685/week @ 2024-09-26 41460/week @ 2024-10-03 38355/week @ 2024-10-10 47301/week @ 2024-10-17 45348/week @ 2024-10-24 44199/week @ 2024-10-31 49532/week @ 2024-11-07 51610/week @ 2024-11-14 35235/week @ 2024-11-21 36783/week @ 2024-11-28 41758/week @ 2024-12-05 38516/week @ 2024-12-12 45222/week @ 2024-12-19 17435/week @ 2024-12-26 39246/week @ 2025-01-02 52673/week @ 2025-01-09

164,123 downloads per month
Used in 145 crates (4 directly)

MIT/Apache

13KB
171 lines

File Id

» Docs

A utility to read file IDs.

Modern file systems assign a unique ID to each file. On Linux and MacOS it is called an inode number, on Windows it is called file index. Together with the device id, a file can be identified uniquely on a device at a given time.

Keep in mind though, that IDs may be re-used at some point.

Example

let file_id = file_id::get_file_id(path).unwrap();

println!("{file_id:?}");

Features

  • serde for serde support, off by default

lib.rs:

Utility for reading inode numbers (Linux, macOS) and file ids (Windows) that uniquely identify a file on a single computer.

Modern file systems assign a unique ID to each file. On Linux and macOS it is called an inode number, on Windows it is called a file id or file index. Together with the device id (Linux, macOS) or the volume serial number (Windows), a file or directory can be uniquely identified on a single computer at a given time.

Keep in mind though, that IDs may be re-used at some point.

Example

let file = tempfile::NamedTempFile::new().unwrap();

let file_id = file_id::get_file_id(file.path()).unwrap();
println!("{file_id:?}");

Example (Windows Only)

let file = tempfile::NamedTempFile::new().unwrap();

let file_id = file_id::get_low_res_file_id(file.path()).unwrap();
println!("{file_id:?}");

let file_id = file_id::get_high_res_file_id(file.path()).unwrap();
println!("{file_id:?}");

Dependencies

~0–8.5MB
~67K SLoC