https://github.com/zipfile/magic.d
D binding around magic number recognition library
https://github.com/zipfile/magic.d
Last synced: 20 days ago
JSON representation
D binding around magic number recognition library
- Host: GitHub
- URL: https://github.com/zipfile/magic.d
- Owner: ZipFile
- License: bsd-2-clause
- Created: 2014-11-26T12:18:06.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-20T14:48:08.000Z (almost 10 years ago)
- Last Synced: 2025-03-16T17:51:30.049Z (11 months ago)
- Language: D
- Size: 146 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# magic.d
D binding around [magic number recognition library](http://www.darwinsys.com/file/ "libmagic").
See `man 3 libmagic` for more info.
## Usage
``` d
import magic;
auto m = new Magic(MAGIC_MIME_TYPE | MAGIC_NO_CHECK_BUILTIN);
m.load(null);
ubyte[] rar = [
0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00, 0xcf,
0x90, 0x73, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
];
assert(m.buffer(rar) == "application/x-rar");
```