What is MIME type "application/x-befunge"?

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

application/x-befunge marks files that hold Befunge source code.
It is used by interpreters and text editors to treat a file as Befunge code.
Befunge is an esoteric programming language with a two-dimensional code layout and self-modifying features.
Files using this MIME type are generally saved with the BEFUNGE format.
Additional details are available on Befunge on Wikipedia.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: application/x-befunge    
  

HTML

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


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

Associated file extensions

FAQs

What is the application/x-befunge MIME type used for?

This MIME type indicates that a file contains source code written in Befunge, a two-dimensional esoteric programming language. It tells the operating system or web server that the content is a script intended for a Befunge interpreter, usually saved with the .befunge extension.

How do I open a file sent as application/x-befunge?

Because Befunge source code is plain text, you can view and edit it using any standard text editor like Notepad, VS Code, or Sublime Text. To actually run the program, however, you will need to download a specific Befunge interpreter or use an online execution environment.

Why does this MIME type start with "x-"?

The x- prefix signifies that the type is non-standard or experimental (not registered with IANA). Since Befunge is a niche esoteric language, it uses application/x-befunge essentially as a custom identifier agreed upon by the community rather than an official standard.

How do I configure Apache to serve .befunge files correctly?

You can add the MIME type definition to your .htaccess file or main configuration. Simply add the line AddType application/x-befunge .befunge to ensure the server sends the correct header instead of defaulting to plain text.

Can web browsers run application/x-befunge files?

No, web browsers cannot natively execute Befunge code. If you navigate to such a file, the browser will likely download it or display it as text. To run the code in a browser, you must wrap it in an HTML page equipped with a JavaScript-based Befunge interpreter.

Is application/x-befunge the same as text/plain?

Technically, the content is just text, but the MIME type application/x-befunge provides specific context about the format. While text/plain allows the file to be read easily in a browser, the specific MIME type helps development tools and IDEs trigger correct syntax highlighting.

Are files with this MIME type dangerous?

The files themselves are harmless plain text documents. However, as with any source code, if you run the file through an interpreter, it will execute commands on your system; always verify the code before running scripts from unknown sources.

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.