| Copyright | Copyright (C) 2005 John Goerzen |
|---|---|
| License | BSD-3-Clause |
| Maintainer | Philippe <philippedev101\@gmail.com> |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Magic.Init
Description
Creating a magic handle and loading magic databases into it. A handle returned
by magicOpen must be given a database with magicLoadDefault or magicLoad
before it can be queried with the functions in Magic.Operations.
Written by John Goerzen.
Synopsis
- magicOpen :: MagicFlags -> IO Magic
- magicLoad :: Magic -> [OsPath] -> IO ()
- magicLoadDefault :: Magic -> IO ()
Documentation
magicOpen :: MagicFlags -> IO Magic Source #
Create a new magic handle configured with the given flags. Combine flags
with ( (see <>)MagicFlags), or pass mempty for the defaults. Before
querying anything you must load a database with magicLoadDefault or
magicLoad.
The handle is freed automatically when it is garbage-collected. Raises an
IOError if the handle cannot be created.
magicLoad :: Magic -> [OsPath] -> IO () Source #
Load the given magic database(s) into the handle. Pass the empty list to
load the system default (equivalent to magicLoadDefault). Raises a
MagicException if a database cannot be loaded.
(libmagic joins the list with the platform search-path separator, so a path that itself contains that separator cannot be represented.)
magicLoadDefault :: Magic -> IO () Source #
Load the system's default magic database into the handle. Raises a
MagicException if the database cannot be loaded.