What is MIME type "text/x-red"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

The MIME type text/x-red flags files that hold source code written in the Red programming language. It tells software and editors that the file contains plain text code and not binary data.
Files such as RED and REDS use this MIME type.
For further technical details, refer to the Red official website.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-red    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-red">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', 'text/x-red');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the purpose of the text/x-red MIME type?

The text/x-red MIME type identifies files containing source code written in the Red programming language. It informs operating systems and text editors that the content is plain text requiring specific syntax highlighting for Red.

How do I configure Apache to serve Red files correctly?

To associate Red files with this MIME type in Apache, add the following line to your .htaccess file or main configuration: AddType text/x-red .red .reds. This ensures browsers and clients receive the correct Content-Type header.

Can web browsers execute text/x-red files?

No, standard web browsers (like Chrome or Firefox) cannot natively execute Red source code. If a browser encounters a file served as text/x-red, it will typically display the code as plain text or prompt the user to download the file.

Why does the MIME type start with x-?

The x- prefix indicates that text/x-red is a non-standard or experimental subtype that has not been officially registered with the IANA. It is a convention used for private or community-defined types to avoid conflicts with future standards.

What is the difference between .red and .reds files?

While both use the text/x-red MIME type, .red usually contains standard Red language code, whereas .reds often signifies Red/System code, a dialect used for lower-level systems programming. Both are plain text formats.

How do I add text/x-red support to Nginx?

Open your mime.types file (usually located in /etc/nginx/) and add the line text/x-red red reds; inside the types block. Reload Nginx to apply the changes so it correctly identifies files with the .red extension.

Is text/x-red binary or plain text?

It is plain text. Even though Red can be compiled into binary executables, the files served with text/x-red are human-readable source code scripts.

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.