Description

D binding around magic number recognition library

Package Information

Version1.0.2 (2016-Feb-20)
Repository https://github.com/ZipFile/magic.d
LicenseBSD 2-clause
CopyrightCopyright © 2014, Anatoliy Anischovich
AuthorsAnatoliy Anischovich
Registered byАнатолий Аниськович
Dependencies none

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

magic.d

D binding around magic number recognition library.

See man 3 libmagic for more info.

Usage

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");

Available versions

1.0.2 1.0.1 1.0.0 ~master