1fileutil::magic::filetype(n) file utilities fileutil::magic::filetype(n)
2
3
4
5______________________________________________________________________________
6
8 fileutil::magic::filetype - Procedures implementing file-type recogni‐
9 tion
10
12 package require Tcl 8.6
13
14 package require fileutil::magic::filetype ?2.0?
15
16 ::fileutil::magic::filetype filename
17
18______________________________________________________________________________
19
21 This package provides a command for the recognition of file types in
22 pure Tcl.
23
24 The core part of the recognizer was generated from a "magic(5)" file
25 containing the checks to perform to recognize files, and associated
26 file-types.
27
28 Beware! This recognizer is large, about 752 Kilobyte of generated Tcl
29 code.
30
31 ::fileutil::magic::filetype filename
32 This command is similar to the command fileutil::fileType.
33
34 Returns a list containing a list of descriptions, a list of
35 mimetype components, and a list file extensions. Returns an
36 empty string if the file content is not recognized.
37
39 [1] File(1) sources [ftp://ftp.astron.com/pub/file/] This site con‐
40 tains the current sources for the file command, including the
41 magic definitions used by it. The latter were used by us to gen‐
42 erate this recognizer.
43
45 This document, and the package it describes, will undoubtedly contain
46 bugs and other problems. Please report such in the category fileutil
47 :: magic of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].
48 Please also report any ideas for enhancements you may have for either
49 package and/or documentation.
50
51 When proposing code changes, please provide unified diffs, i.e the out‐
52 put of diff -u.
53
54 Note further that attachments are strongly preferred over inlined
55 patches. Attachments can be made by going to the Edit form of the
56 ticket immediately after its creation, and then using the left-most
57 button in the secondary navigation bar.
58
60 file(1), fileutil, magic(5)
61
63 file recognition, file type, file utilities, type
64
66 Programming tools
67
68
69
70tcllib 2.0 fileutil::magic::filetype(n)