IdentifyMimeType 2.0.0

Bundle
org.apache.nifi | nifi-standard-nar
Description
Attempts to identify the MIME Type used for a FlowFile. If the MIME Type can be identified, an attribute with the name 'mime.type' is added with the value being the MIME Type. If the MIME Type cannot be determined, the value will be set to 'application/octet-stream'. In addition, the attribute 'mime.extension' will be set if a common file extension for the MIME Type is known. If the MIME Type detected is of type text/*, attempts to identify the charset used and an attribute with the name 'mime.charset' is added with the value being the charset.
Tags
MIME, bzip2, compression, file, gzip, identify, mime.type, zip
Input Requirement
REQUIRED
Supports Sensitive Dynamic Properties
false
  • Additional Details for IdentifyMimeType 2.0.0

    IdentifyMimeType

    The following is a non-exhaustive list of MIME Types detected by default in NiFi:

    • application/gzip
    • application/bzip2
    • application/flowfile-v3
    • application/flowfile-v1
    • application/xml
    • video/mp4
    • video/x-m4v
    • video/mp4a-latm
    • video/quicktime
    • video/mpeg
    • audio/wav
    • audio/mp3
    • image/bmp
    • image/png
    • image/jpg
    • image/gif
    • image/tif
    • application/vnd.ms-works
    • application/msexcel
    • application/mspowerpoint
    • application/msaccess
    • application/x-ms-wmv
    • application/pdf
    • application/x-rpm
    • application/tar
    • application/x-7z-compressed
    • application/java-archive
    • application/zip
    • application/x-lzh

    An example value for the Config Body property that will identify a file whose contents start with “abcd” as MIME Type " custom/abcd" and with extension “.abcd” would look like the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <mime-info>
        <mime-type type="custom/abcd">
            <magic priority="50">
                <match value="abcd" type="string" offset="0"/>
            </magic>
            <glob pattern="\*.abcd"/>
        </mime-type>
    </mime-info>
    

    For a more complete list of Tika’s default types (and additional details regarding customization of the value for the Config Body property), please refer to Apache Tika’s documentation

Properties
Relationships
Name Description
success All FlowFiles are routed to success
Writes Attributes
Name Description
mime.type This Processor sets the FlowFile's mime.type attribute to the detected MIME Type. If unable to detect the MIME Type, the attribute's value will be set to application/octet-stream
mime.extension This Processor sets the FlowFile's mime.extension attribute to the file extension associated with the detected MIME Type. If there is no correlated extension, the attribute's value will be empty
mime.charset This Processor sets the FlowFile's mime.charset attribute to the detected charset. If unable to detect the charset or the detected MIME type is not of type text/*, the attribute will not be set