From 1c96427a7e5970a7ca8e270465440e53b8abd1b3 Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Tue, 9 Jan 2024 18:51:20 -0500 Subject: [PATCH] add Header predicates: islink, isfile, etc. --- src/header.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/header.jl b/src/header.jl index 8f9122e..37231ab 100644 --- a/src/header.jl +++ b/src/header.jl @@ -65,6 +65,13 @@ const TYPE_SYMBOLS = ( '6' => :fifo, ) +Base.isfile(hdr::Header) = hdr.type == :file +Base.islink(hdr::Header) = hdr.type == :symlink +Base.ischardev(hdr::Header) = hdr.type == :chardev +Base.isblockdev(hdr::Header) = hdr.type == :blockdev +Base.isdir(hdr::Header) = hdr.type == :directory +Base.isfifo(hdr::Header) = hdr.type == :fifo + function to_symbolic_type(type::Char) for (t, s) in TYPE_SYMBOLS type == t && return s