MIME Type
MIME Type (Media Type Identifier)
A standardized label in the format type/subtype (such as text/html or image/png) that identifies the nature and format of a file or data stream, used by web servers and browsers to handle content correctly.
技術的詳細
MIME types (RFC 6838) consist of a top-level type (application, audio, font, image, model, text, video), a subtype, and optional parameters (e.g., text/html; charset=utf-8). IANA maintains the official registry. Servers declare MIME types via the Content-Type HTTP header. Browsers may perform MIME sniffing when the declared type is missing or generic (application/octet-stream), which the X-Content-Type-Options: nosniff header prevents. The accept header in requests indicates which MIME types the client can handle.
例
```javascript
// MIME Type: web API example
const response = await fetch('/api/resource');
const data = await response.json();
console.log(data);
```