Tcl Library Source Code
fileutil::magic::filetype - file utilities
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

fileutil::magic::filetype(n) 1.2.0 tcllib "file utilities"

Name

fileutil::magic::filetype - Procedures implementing file-type recognition

Synopsis

  • package require Tcl 8.6
  • package require fileutil::magic::filetype ?1.2.0?

Description

This package provides a command for the recognition of file types in pure Tcl.

The core part of the recognizer was generated from a "magic(5)" file containing the checks to perform to recognize files, and associated file-types.

Beware! This recognizer is large, about 752 Kilobyte of generated Tcl code.

::fileutil::magic::filetype filename

This command is similar to the command fileutil::fileType.

Returns a list containing a list of descriptions, a list of mimetype components, and a list file extensions. Returns an empty string if the file content is not recognized.

REFERENCES

  1. File(1) sources This site contains the current sources for the file command, including the magic definitions used by it. The latter were used by us to generate this recognizer.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category fileutil :: magic of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

See Also

file(1), fileutil, magic(5)

Category

Programming tools