mime.essence


获取 MIME 的精髓。 这个属性是只读的。 使用 mime.typemime.subtype 改变 MIME。

import { MIMEType } from 'node:util';

const myMIME = new MIMEType('text/javascript;key=value');
console.log(myMIME.essence);
// 打印: text/javascript
myMIME.type = 'application';
console.log(myMIME.essence);
// 打印: application/javascript
console.log(String(myMIME));
// 打印: application/javascript;key=valueconst { MIMEType } = require('node:util');

const myMIME = new MIMEType('text/javascript;key=value');
console.log(myMIME.essence);
// 打印: text/javascript
myMIME.type = 'application';
console.log(myMIME.essence);
// 打印: application/javascript
console.log(String(myMIME));
// 打印: application/javascript;key=value

Gets the essence of the MIME. This property is read only. Use mime.type or mime.subtype to alter the MIME.

import { MIMEType } from 'node:util';

const myMIME = new MIMEType('text/javascript;key=value');
console.log(myMIME.essence);
// Prints: text/javascript
myMIME.type = 'application';
console.log(myMIME.essence);
// Prints: application/javascript
console.log(String(myMIME));
// Prints: application/javascript;key=valueconst { MIMEType } = require('node:util');

const myMIME = new MIMEType('text/javascript;key=value');
console.log(myMIME.essence);
// Prints: text/javascript
myMIME.type = 'application';
console.log(myMIME.essence);
// Prints: application/javascript
console.log(String(myMIME));
// Prints: application/javascript;key=value