Crates.io | nu_plugin_file |
lib.rs | nu_plugin_file |
version | 0.11.0 |
source | src |
created_at | 2024-09-09 14:56:59.53166 |
updated_at | 2024-11-14 17:43:35.421557 |
description | a nushell plugin called file |
homepage | |
repository | https://github.com/fdncred/nu_plugin_file |
max_upload_size | |
id | 1369402 |
size | 149,163 |
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] │
╰──────────────┴──────────╯
❯ file ~/.cargo/bin/nu | table -e
╭─────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ description │ mach-o binary, arm64 │
│ format │ Executable │
│ │ ╭─#─┬─offset─┬─length─┬────────bytes─────────╮ │
│ magics │ │ 0 │ 0 │ 4 │ [207, 250, 237, 254] │ │
│ │ ╰───┴────────┴────────┴──────────────────────╯ │
│ │ ╭──────────────┬───────────────────────────────────────────────────────────────────────────────────────╮ │
│ details │ │ arch │ arm64 │ │
│ │ │ format │ mach-o │ │
│ │ │ │ ╭───┬───────────────────────────────────────────────────────────────────────────────╮ │ │
│ │ │ dependencies │ │ 0 │ /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation │ │ │
│ │ │ │ │ 1 │ /usr/lib/libobjc.A.dylib │ │ │
│ │ │ │ │ 2 │ /System/Library/Frameworks/Security.framework/Versions/A/Security │ │ │
│ │ │ │ │ 3 │ /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation │ │ │
│ │ │ │ │ 4 │ /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices │ │ │
│ │ │ │ │ 5 │ /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit │ │ │
│ │ │ │ │ 6 │ /usr/lib/libiconv.2.dylib │ │ │
│ │ │ │ │ 7 │ /usr/lib/libSystem.B.dylib │ │ │
│ │ │ │ ╰───┴───────────────────────────────────────────────────────────────────────────────╯ │ │
│ │ ╰──────────────┴───────────────────────────────────────────────────────────────────────────────────────╯ │
╰─────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
git clone https://github.com/fdncred/nu_plugin_file.git
cargo install --path .
plugin add /path/to/nu_plugin_file
plugin use /path/to/nu_plugin_file
file some.jpg