class Magic::Magic
- Magic::Magic
- Reference
- Object
Defined in:
magic/magic.crConstructors
Instance Method Summary
-
#buffer(buf : Bytes)
Returns a textual description of the contents of the argument passed as a buffer or Nil if an error occurred and the
MagicFlags::ERRORflag is set. -
#buffer(buf : String)
Returns a textual description of the contents of the argument passed as a buffer or Nil if an error occurred and the
MagicFlags::ERRORflag is set. -
#check(dbs : String)
Check the validity of entries in the colon separated list of database files passed as argument or the default database file if no argument.
-
#close
Closes the magic database and deallocates any resources used.
-
#compile(dbs : String)
Compile entries in the colon separated list of database files passed as argument or the default database file if no argument.
-
#descriptor(file : File)
Returns a textual description of the contents of the argument passed as a file or Nil if an error occurred and the
MagicFlags::ERRORflag is set. -
#errno
Returns a numeric error code.
-
#error
Returns a textual explanation of the last error or Nil if there was no error.
-
#file(filename)
Returns a textual description of the contents of the argument passed as a filename or Nil if an error occurred and the
MagicFlags::ERRORflag is set. -
#get_param(param : MagicParam)
Returns the param value if successful, raises if param was unknown
- #list(dbs : String)
-
#load(filename = nil)
Must be called to load entries in the colon separated list of database files passed as argument or the default database file if no argument before any magic queries can be performed.
-
#set_flags(flags : MagicFlags)
Set flags on the magic object which determine how magic checking behaves; a bitwise OR of the flags described in libmagic(3).
-
#set_param(param : MagicParam)
Returns true if successful
Constructor Detail
Instance Method Detail
Returns a textual description of the contents of the argument passed
as a buffer or Nil if an error occurred and the MagicFlags::ERROR
flag is set. A call to errno() will return the numeric error code.
Returns a textual description of the contents of the argument passed
as a buffer or Nil if an error occurred and the MagicFlags::ERROR
flag is set. A call to errno() will return the numeric error code.
Check the validity of entries in the colon separated list of database files passed as argument or the default database file if no argument.
Compile entries in the colon separated list of database files passed as argument or the default database file if no argument. The compiled files created are named from the basename(1) of each file argument with ".mgc" appended to it.
Returns a textual description of the contents of the argument passed
as a file or Nil if an error occurred and the MagicFlags::ERROR
flag is set. A call to errno() will return the numeric error code.
Returns a numeric error code. If return value is 0, an internal magic error occurred. If return value is non-zero, the value is an OS error code. Use the errno module or os.strerror() can be used to provide detailed error information.
Returns a textual description of the contents of the argument passed
as a filename or Nil if an error occurred and the MagicFlags::ERROR flag
is set. A call to errno() will return the numeric error code.
Returns the param value if successful, raises if param was unknown
Must be called to load entries in the colon separated list of database files passed as argument or the default database file if no argument before any magic queries can be performed.
Set flags on the magic object which determine how magic checking
behaves; a bitwise OR of the flags described in libmagic(3).
Raises on systems that don't support utime(2) or utimes(2)
when MagicFlags::PRESERVE_ATIME is set.