What is MIME type "chemical/x-cdx"?
A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.
The MIME type chemical/x-cdx is a format made for storing chemical structure drawings. It is most often used in chemical drawing software like ChemDraw.Files such as CDX and those using the ChemDraw Exchange format like CDXML carry this MIME type.
It holds data about atoms, bonds, and molecular coordinates. This information lets programs reproduce and analyze chemical structures.
- Software Integration: It works with tools that build and edit chemical diagrams.
- Data Sharing: It lets chemists exchange structure information between different systems.
- Research Use: It helps in reproducibility and sharing of chemical data in academic and industrial labs.
Associated file extensions
Usage Examples
HTTP Header
When serving content with this MIME type, set the Content-Type header:
Content-Type: chemical/x-cdx
HTML
In HTML, you can specify the MIME type in various elements:
<a href="file.dat" type="chemical/x-cdx">Download file</a>
Server-side (Node.js)
Setting the Content-Type header in Node.js:
const http = require('http');
http.createServer((req, res) => {
res.setHeader('Content-Type', 'chemical/x-cdx');
res.end('Content here');
}).listen(3000);
Associated file extensions
FAQs
What is the chemical/x-cdx MIME type used for?
The MIME type chemical/x-cdx is primarily used to identify files containing chemical structure data created by ChemDraw. It tells the browser or operating system that the file contains atoms, bonds, and molecular coordinates, typically associated with the .cdx or .cdxml extensions.
How do I open a file sent as chemical/x-cdx?
Files served with this MIME type are best opened using PerkinElmer ChemDraw. Other chemical informatics tools, such as ChemDoodle or conversion utilities like Open Babel, may also import or view these files.
How do I configure Apache to serve .cdx files correctly?
To ensure your Apache server sends the correct headers, add the following line to your .htaccess file or main configuration: AddType chemical/x-cdx .cdx .cdxml. This prevents the server from sending the file as a generic binary stream.
Do web browsers support chemical/x-cdx natively?
No, modern browsers like Chrome and Firefox do not render chemical structures natively. Users will typically be prompted to download the file, or they must have a specific browser plugin (such as the ChemDraw Plugin) installed to view the structure inline.
What is the difference between CDX and CDXML files?
While both often use the chemical/x-cdx type, .cdx is a proprietary binary format, whereas .cdxml is an XML-based format. The XML version is human-readable and easier for third-party scripts to parse, but the binary version is more compact.
How do I set up Nginx for chemical/x-cdx?
In Nginx, open your mime.types file (usually located in /etc/nginx/) and add the line: chemical/x-cdx cdx cdxml;. Reload the Nginx service to apply the changes.
Why does my browser download the CDX file instead of opening it?
This happens because the browser lacks a built-in viewer for chemical/x-cdx content. Unless a specific plugin is active to handle this MIME type, the browser defaults to downloading the file so you can open it with a desktop application like ChemDraw.
General FAQ
What is a MIME type?
A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.
MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.
How do I find the MIME type for a file?
You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.
Why are multiple MIME types listed for one extension?
Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.