#file #index #inode #read-file #linux-macos #system

bin+lib file-id

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

3 unstable releases

0.2.1 Aug 21, 2023
0.2.0 Aug 20, 2023
0.1.0 May 17, 2023

#667 in Filesystem

Download history 25829/week @ 2024-01-03 25284/week @ 2024-01-10 31054/week @ 2024-01-17 30051/week @ 2024-01-24 31291/week @ 2024-01-31 30236/week @ 2024-02-07 33313/week @ 2024-02-14 40377/week @ 2024-02-21 39084/week @ 2024-02-28 41885/week @ 2024-03-06 34512/week @ 2024-03-13 43218/week @ 2024-03-20 37270/week @ 2024-03-27 38846/week @ 2024-04-03 31076/week @ 2024-04-10 32897/week @ 2024-04-17

148,565 downloads per month
Used in 86 crates (3 directly)

MIT/Apache

11KB
138 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–12MB
~94K SLoC