This nushell plugin will open files to inspect them and report back a little information. It uses magic bytes to determine many file formats. The core code was "borrowed" from a spacedrive crate that I thought looked interesting.
❯ help file
View file format information
Usage:
> file <filename>
Flags:
-h, --help - Display the help message for this command
Parameters:
filename <string>: full path to file name to inspect
Examples:
Get format information from file
> file some.jpg
╭──────────────┬──────────╮
│ description │ Image │
│ format │ jpg │
│ magic_offset │ 0 │
│ magic_length │ 2 │
│ magic_bytes │ [FF, D8] │
╰──────────────┴──────────╯
- clone repo
git clone https://github.com/fdncred/nu_plugin_file.git
- install with cargo
cargo install --path .
- register with nushell
register /path/to/nu_plugin_file
- inspect a file
file some.jpg