Register an extension or MIME type for automatic detection in Import, Export, and FileFormat
Contributed by:
Sean Cheren
Examples
Basic Examples (2)
Register "myjson" to the "JSON" format:
Now "myjson" will additionally be recognized as an extension for "JSON":
Register format "myFmt":
Register an extension for "myFmt":
Import, Export, and FileFormat, now infer the extension from the file name:
Scope (6)
RegisterFormat can also be used to modify the MIME type or extension of an existing format. Create a test file with a custom extension "mycsv" to register to "CSV":
The extension .csv should already be recognized:
By default, "mycsv" would be imported at "Text":
Register "mycsv" to the "CSV" format:
Now "mycsv" will additionally be recognized as an extension for "CSV":
The original extensions still work:
Related Links
Version History
-
1.0.1
– 31 July 2026
-
1.0.0
– 25 October 2019
Related Resources
Author Notes
In 12.0 the mime type registration is mostly pointless, it can only be accessed via
Import["file.txt","MIMEType"].
In 12.1 it will be used by Import when importing from a URL, and be accessible with new utility functions:
ImportExport`FormatName,
ImportExport`FormatToMIMEType (
List),
ImportExport`FormatToExtension (
List),
ImportExport`MIMETypeToFormat (
List),
ImportExport`ExtensionToFormat (
List) will all work with these.