This is the trivial-mimes Reference Manual, version 1.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 08 19:48:11 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
trivial-mimes
Tiny library to detect mime types in files.
Yukari Hafner <shinmera@tymoon.eu>
Yukari Hafner <shinmera@tymoon.eu>
(GIT https://github.com/Shinmera/trivial-mimes.git)
zlib
1.1.0
mime-types.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
trivial-mimes/mime-types.lisp
trivial-mimes
(system).
*mime-db*
(special variable).
find-mime.types
(function).
mime
(function).
mime-add
(function).
mime-case
(macro).
mime-equal
(function).
mime-file-type
(function).
mime-lookup
(function).
mime-probe
(function).
%read-tokens
(function).
*reverse-mime-db*
(special variable).
build-mime-db
(function).
valid-name-p
(function).
whitespace-p
(function).
Packages are listed by definition order.
trivial-mimes
mimes
org.tymoonnext.trivial-mimes
common-lisp
.
*mime-db*
(special variable).
find-mime.types
(function).
mime
(function).
mime-add
(function).
mime-case
(macro).
mime-equal
(function).
mime-file-type
(function).
mime-lookup
(function).
mime-probe
(function).
%read-tokens
(function).
*reverse-mime-db*
(special variable).
build-mime-db
(function).
valid-name-p
(function).
whitespace-p
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
An EQUALP hash-table with file-extensions as keys and the mime-types as values.
A case-like macro that works with MIME type of FILE.
Otherwise clause is the last clause that starts with T or OTHERWISE,.
Example:
(mime-case #p"~/CHANGES.txt"
(("application/json" "application/*") "Something opaque...")
("text/plain" "That’s a plaintext file :D")
(t "I don’t know this type!"))
Attempts to find a usable MIME.TYPES file. If none can be found, an error is signalled.
Attempts to detect the mime-type of the given pathname.
First uses MIME-LOOKUP, then MIME-PROBE and lastly returns the DEFAULT if both fail.
Add MIME and FILE-EXTENSIONS associations to *MIME-DB* and *REVERSE-MIME-DB*. Makes the provided MIME and FILE-EXTENSIONS properly look-up-able with MIME, MIME-PROBE and other trivial-mimes functions.
Checks whether M1 and M2 are matching.
In particular, checks the match of type and subtype (any of which can
be asterisks), discarding any parameters there might be.
(mime-equal "text/*" "text/html")
T
(mime-equal "text/html" "text/html;charset=utf8")
T
(mime-equal "*/*" "application/octet-stream")
T
(mime-equal "text/*" "application/octet-stream")
NIL
Returns a matching file-extension for the given mime-type. If the given mime-type cannot be found, NIL is returned.
Attempts to get the mime-type by file extension comparison. If none can be found, NIL is returned.
Attempts to get the mime-type through a call to the FILE shell utility. If the file does not exist or the platform is not unix, NIL is returned.
An EQUALP hash-table with mime-types as keys and the file-extensions as values.
Populates the *MIME-DB* with data gathered from the file.
The file should have the following structure:
MIME-TYPE FILE-EXTENSION*
According to RFC6838 type names MUST start with an alphanumeric character This also conveniently skips comments
Jump to: | %
B F M V W |
---|
Jump to: | %
B F M V W |
---|
Jump to: | *
S |
---|
Jump to: | *
S |
---|
Jump to: | F M P S T |
---|
Jump to: | F M P S T |
---|