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

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

application/x-xar is the MIME type for XAR files.
This archive format bundles many files into one package and uses an XML table of contents to manage metadata and the archive structure. It keeps file details intact and can include digital signatures for security.
Key uses: This format offers flexibility for various platforms and tasks. For more details, check out XAR Archive.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: application/x-xar    
  

HTML

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


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

Associated file extensions

FAQs

How do I open a file with the application/x-xar MIME type?

On macOS, the XAR format is supported natively via the command line or the built-in Archive Utility. On Windows, you can open these files using third-party compression tools like 7-Zip or WinRAR. Linux users can install the xar package via their distribution's package manager.

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

To ensure your Apache server sends the correct Content-Type header, add the following line to your .htaccess file or main configuration: AddType application/x-xar .xar. This prevents browsers from misinterpreting the archive as generic text or binary data.

What is the correct Nginx configuration for application/x-xar?

In your Nginx setup, open the mime.types file (usually located in /etc/nginx/) and ensure the following entry exists inside the types block: application/x-xar xar;. If you cannot edit the global types, you can add it directly to your server block configuration.

Is application/x-xar related to Excel files?

No, this is a common misconception due to the file extension similarity. XAR stands for Extensible Archive Format, whereas Excel files use MIME types like application/vnd.ms-excel or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. Always check the file extension to confirm the file type.

Why are XAR files commonly found on macOS systems?

Apple utilizes the XAR format extensively for software distribution. Many macOS installer packages (.pkg files) are actually XAR archives containing the software payload, scripts, and an XML Table of Contents detailing the package structure and digital signatures.

Does application/x-xar support digital signatures?

Yes, one of the key features of the XAR format is its support for security. The XML header allows for storing digital signatures and checksums (like SHA-1 or MD5) for every file within the archive, ensuring data integrity and verifying the source.

Why does my browser download the .xar file instead of displaying it?

Browsers are not designed to render archive formats like XAR, ZIP, or TAR natively. When a server sends the application/x-xar header, the browser recognizes it as a binary file requiring an external application, prompting a download dialog.

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.