NAME

File::ArchivableFormats - Be able to select archivable formats

VERSION

version 1.2

SYNOPSIS

use File::ArchivableFormat;

my $archive = File::ArchivableFormat->new();

open my $fh, '<', 'path/to/file';

my $result = $archive->identify_from_fh($fh);

my $result = $archive->identify_from_path('/path/to/file');

DESCRIPTION

TODO: Add clear description

ATTRIBUTES

magic

The File::LibMagic accessor

METHODS

parse_extension

Parses the filename and returns the extension. Uses "fileparse" in File::Basename

identify_from_fh

Identify the file from a file handle. Please note that this does not work with a File::Temp filehandle.

Returns a data structure like this:

{
    # DANS is the Prefered format list
    'DANS' => {
        # Types tell  you something about why something is on the
        # prefered format list
        'types' => [
            'Plain text (Unicode)',
            'Plain text (Non-Unicode)',
            'Statistical data (data (.csv) + setup)',
            'Raspter GIS (ASCII GRID)',
            'Raspter GIS (ASCII GRID)'
        ],
        # The extensions by which belongs to the mime type/file
        'allowed_extensions' => ['.asc', '.txt'],
        # Boolean which tells you if the file is archivable and
        # therfore prefered.
        'archivable'         => 1
    },
    'mime_type' => 'text/plain'
};

identify_from_path

Identify the file from path/filename.

identify_from_mimetype

Identify based on the mimetype

identify_via_libexif

Identify mimetype via libexif. You will need to have Archive::Zip installed for MS Office documents

FUNCTIONS

installed_drivers

Returns an array with all the installed plugins.

SEE ALSO

IANA

http://www.iana.org/assignments/media-types/media-types.xhtml

http://www.iana.org/assignments/media-types/application.csv

File::LibMagic

AUTHOR

Wesley Schwengle <wesley@mintlab.nl>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by Mintlab BV.

This is free software, licensed under:

The European Union Public License (EUPL) v1.1