Skip to content

Commit

Permalink
Add Brotli compressed file support to fv and fvi
Browse files Browse the repository at this point in the history
Other compressed files like tar balls aren't also supported because
Brotli doesn't seem to be used on those in the wild. A few type names
also have a dash added for consistency.
  • Loading branch information
dfandrich committed Jan 31, 2025
1 parent 1cb5ad3 commit 769f500
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
20 changes: 13 additions & 7 deletions fv
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ for f in "$@" ; do
blend_info -- "$f"
;;

# requires: brotli
*.br) archive_label brotli-compressed file
# This will be slow on large files because it actually decompresses
brotli -tv -- "$f"
;;

# See http://www.star.le.ac.uk/~tjg/bun/ (defunct as of 2021)
# requires: bun
# (Untested)
Expand Down Expand Up @@ -396,7 +402,7 @@ for f in "$@" ; do
# See https://mattmahoney.net/dc/
# See https://sourceforge.net/projects/kgbarchiver/
# Also KGB archive .kgb
*.pq6 | *.kgb) archive_label PAQ6 compressed archive
*.pq6 | *.kgb) archive_label PAQ6-compressed archive
sed '//,$d' < "$f"
;;

Expand All @@ -413,7 +419,7 @@ for f in "$@" ; do

# requires: unrar
# Also SNES sound archive .rsn
*.rar | *.rsn) archive_label RAR compressed archive
*.rar | *.rsn) archive_label RAR-compressed archive
unrar v -idc -- "$f"
;;

Expand Down Expand Up @@ -576,7 +582,7 @@ EOF

# Also Tukaani Linux package .tlz
# requires: lzma, tar
*.tlz | *.tar.lzma) archive_label LZMA compressed tar archive
*.tlz | *.tar.lzma) archive_label LZMA-compressed tar archive
lzma -dc -- "$f" | tar tvf -
;;

Expand Down Expand Up @@ -679,7 +685,7 @@ EOF

# See https://mattmahoney.net/dc/zpaq.html
# requires: zpaq
*.zpaq) archive_label ZPAQ compressed archive
*.zpaq) archive_label ZPAQ-compressed archive
zpaq l "$sf"
;;

Expand Down Expand Up @@ -727,19 +733,19 @@ EOF
;;

# requires: lzip
*.lz) archive_label LZIP compressed file
*.lz) archive_label LZIP-compressed file
lzip -lv -- "$f"
;;

# See https://www.lzop.org/
# requires: lzop
*.lzo) archive_label LZOP compressed file
*.lzo) archive_label LZOP-compressed file
lzop -vl -- "$f"
;;

# See https://www.7-zip.org/sdk.html
# requires: lzma || python >= 3
*.lzma) archive_label LZMA compressed file
*.lzma) archive_label LZMA-compressed file
if which lzmainfo >/dev/null 2>&1 ; then
lzmainfo -- "$f"
else
Expand Down
11 changes: 8 additions & 3 deletions fvi
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ for f in "$@" ; do
avitype -- "$f"
;;

# requires: brotli
*.br) filetype_label brotli-compressed file
# This will be slow on large files because it actually decompresses
brotli -tv -- "$f"
;;

# requires: Java jdk
*.class) filetype_label Java compiled class file
Expand Down Expand Up @@ -501,7 +506,7 @@ for f in "$@" ; do
;;

# requires: unrar
*.rar | *.rsn) filetype_label RAR compressed archive
*.rar | *.rsn) filetype_label RAR-compressed archive
unrar vta -sl0 -idc -- "$f"
;;

Expand Down Expand Up @@ -792,15 +797,15 @@ EOF
# requires: fv, lzma
# Also Tukaani Linux package .tlz
*.tlz | \
*.lzma) filetype_label LZMA compressed file
*.lzma) filetype_label LZMA-compressed file
fv -t lzma "$f"
;;

# requires: fv, xz
# Also Midnight BSD ports package .mport
# Also xz-compressed tar archive .txz
*.txz | *.mport | \
*.xz) filetype_label XZ compressed file
*.xz) filetype_label XZ-compressed file
fv -t xz "$f"
;;

Expand Down

0 comments on commit 769f500

Please sign in to comment.