Search Shortcut cmd + k | ctrl + k
magic

libmagic/file utilities ported to DuckDB

Installing and Loading

INSTALL magic FROM community;
LOAD magic;

Example

SELECT file, magic_mime(file), magic_type(file) FROM glob('path/to/folder/**');

About magic

Very experimental port of libmagic (that powers file UNIX utility), allow to classify files based on the the content of the header, accoring to the libmagic library. Packaged with version 5.45 of the magic library. The magic.mgc database is at the moment statically compiled in the library, so it's the same across platforms but immutable. Currently not available in Windows and Wasm, due to different but likely solvable compile time problems to be sorted out independently.

Added Functions

function_name function_type description comment example
magic_mime scalar      
magic_type scalar