温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/util/MIMEType
点击访问原文链接

Node util.MIMEType class | API Reference | Bun

Node util.MIMEType class | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:util/MIMETypeCoconstructorPessencePparamsPsubtypeMtoStringPtype

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:util/MIMETypeCoconstructorPessencePparamsPsubtypeMtoStringPtype

class

util.MIMETypeclass MIMEType

An implementation of the MIMEType class.

In accordance with browser conventions, all properties of MIMEType objects are implemented as getters and setters on the class prototype, rather than as data properties on the object itself.

A MIME string is a structured string containing multiple meaningful components. When parsed, a MIMEType object is returned containing properties for each of these components.

readonly essence: string

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=value
readonly params: MIMEParams

Gets the MIMEParams object representing the parameters of the MIME. This property is read-only. See MIMEParams documentation for details.

subtype: string

Gets and sets the subtype portion of the MIME.

import { MIMEType } from 'node:util';

const myMIME = new MIMEType('text/ecmascript');
console.log(myMIME.subtype);
// Prints: ecmascript
myMIME.subtype = 'javascript';
console.log(myMIME.subtype);
// Prints: javascript
console.log(String(myMIME));
// Prints: text/javascript
type: string

Gets and sets the type portion of the MIME.

import { MIMEType } from 'node:util';

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

The toString() method on the MIMEType object returns the serialized MIME.

Because of the need for standard compliance, this method does not allow users to customize the serialization process of the MIME.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node util.MIMEType class | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/). In accordance with browser conventions, all properties of `MIMEType` objects are implemented as getters and setters on the class prototype, rather than as data properties on the object itself. A MIME string is a structured string containing multiple meaningful components. When parsed, a `MIMEType` object is returned containing properties for each of these components.