std::string get(fs::path const &path) const
Identify content from a filesystem path.
DISABLE_COPY(Context)
Copying is disabled (single owner of the libmagic handle).
std::string get(int fd) const
Identify content from an open file descriptor.
bool isReady() const noexcept
Whether the context is initialized and ready to be used.
Definition Context.hpp:80
std::string get(std::span< uint8_t > const &data) const
Identify content from an in-memory buffer.
std::string lastError() const
Retrieve the last error message from libmagic.
Context(Context &&other) noexcept
Move-construct a context.
Context & operator=(Context &&other) noexcept
Move-assign a context.
Context(int flags=-1, fs::path const &magicDb={})
Construct a libmagic context and load the magic database.
~Context()
Destroy the context and release the underlying libmagic handle.
static int defaultFlags
Default libmagic flags used when the constructor argument flags is -1.
Definition Context.hpp:122