refuel.mixedup.dev/docs/ReFile.md
2024-08-30 18:36:29 +03:00

1.6 KiB

ReFile Tool Guide

This is a very simple command that will consume files directories or stdin to resolve its file types.

ReFile - Simple Tool demonstrating ReMime

ReMime Command Line Tool - Determine file Media Type

    refile [-r] file/directory/-...

    file       infer a file
    directory  infer files in directory. Requires -r
    -          infer from standard input.
    -r         search files and folders recursively.
    -a         include hidden files.
    -v         verbose mode, use full paths.
    --list     list known mime types. Will ignore files.
    --help     show this help text.

Listing Types

Use refile --list to list known media types.

$ refile --list | head
video/avi
audio/wav
image/vnd.microsoft.icon
image/webp
application/vnd.rar
application/postscript
application/pdf
audio/mp3
audio/flac
audio/midi

Listing Files & Directories

Just pass the path strings into the command line. Use -r to recursively traverse subdirectories. Here is an annotated command output:

# Lines beginning with # are comments.
#   +--- Extension matched.
#   |+-- Content matched.
#   ||          
#   ||      File path                       Media Type
#   ||      -----------------------------   ------------------------
    --      toc.yml                         application/octet-stream
    ec      ../../../Downloads/image2.png   image/png
    e-      _site.tar.gz                    application/gzip
    e-      index.md                        text/markdown
    e-      docfx.json                      application/json
    # Skipping directory docs, set -r to traverse.