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

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

text/x-sourcepawn is a MIME type that marks files containing SourcePawn code. This type helps software, like text editors and web servers, treat the file as plain text with programming syntax.



Files using this MIME type are stored with the extension SP. They are plain text files that you can open with almost any text editor.


For more technical details on MIME types, visit the Mozilla Developer Network.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: text/x-sourcepawn    
  

HTML

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


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

Associated file extensions

FAQs

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

This MIME type identifies files containing SourcePawn source code, which is a scripting language used primarily for creating plugins for SourceMod. It tells the operating system and web servers that the file is plain text containing code, usually associated with the .sp extension.

How do I open a file marked as text/x-sourcepawn?

Because these are plain text files, you can open them with any standard text editor like Notepad, Notepad++, or Visual Studio Code. To edit the code effectively, it is recommended to use an editor that supports syntax highlighting for SourcePawn.

How do I configure Apache to serve .sp files with this MIME type?

To ensure your Apache server serves .sp files with the correct content type, add the following line to your .htaccess file or main configuration: AddType text/x-sourcepawn .sp. This helps browsers and development tools identify the file correctly.

What is the difference between a text/x-sourcepawn file and a .smx file?

The text/x-sourcepawn file (ending in .sp) is the human-readable source code that developers write. The .smx file is the compiled binary version that the game server actually executes; you cannot run the .sp file directly without compiling it first.

Why does my browser download the .sp file instead of showing it?

Most web browsers do not natively render text/x-sourcepawn content, so they default to downloading the file. To force the browser to display the code inline, the server would need to send the file as text/plain or use a Content-Disposition: inline header.

How do I add support for text/x-sourcepawn in Nginx?

In your Nginx configuration file (usually nginx.conf or inside sites-available), locate the types block and add the following line: text/x-sourcepawn sp;. After saving the file, reload Nginx to apply the changes.

Is text/x-sourcepawn a secure file type?

Yes, files with this MIME type are simple text files and cannot execute code on your computer just by opening them. However, you should always be cautious when downloading scripts from untrusted sources, as the compiled version could contain malicious server logic.

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.