Haskell libmagic how to use it?

I am trying to write a program that will check the file type of a specific file, and I found a haskell library that should do the trick. The problem occurs when I try to use it. I have no idea what to do, what function to call, etc. The library is full of mysterious commands without examples, without a textbook or home page.

Please, help.

+4
source share
1 answer

There is documentation containing brief descriptions of important functions (of which there are not many). For more information on what the C base library (and therefore also the Haskell library) does , see the libmagic page .

The main use should look something like this (untested):

import Magic.Init import Magic.Operations main = do magic <- magicOpen [] loadDefaultMagic magic magicFile magic "/my/file" >>= print 
+4
source

Source: https://habr.com/ru/post/1302612/


All Articles