MIMEType
[<Interface>]
type MIMEType =
abstract member essence: string
abstract member params: MIMEParams
abstract member subtype: string with get, set
abstract member type: string with get, set
static member Create (type: string, subtype: string, essence: string, params: MIMEParams, toString: unit -> string) : MIMEType
abstract member toString () : string| Assembly | Xantham.Fable.Node |
| Attributes | [<Interface>] |
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.
@since v19.1.0, v18.13.0
Declared inside
Input |
Properties
abstract member essence: string
abstract member essence: stringGets 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
abstract member params: MIMEParams
abstract member params: MIMEParamsGets the MIMEParams object representing the parameters of the MIME. This property is read-only. See MIMEParams documentation for details.
abstract member subtype: string with get, set
abstract member subtype: string with get, setGets 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
abstract member type: string with get, set
abstract member type: string with get, setGets 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
Methods
static member Create (type: string, subtype: string, essence: string, params: MIMEParams, toString: unit -> string) : MIMEType