MIMEParams
[<Interface>]
type MIMEParams =
abstract member delete (name: string) : unit
abstract member entries () : Iterator<(string * string),obj,obj>
abstract member get (name: string) : string option
abstract member has (name: string) : bool
abstract member keys () : Iterator<string,obj,obj>
abstract member set (name: string, value: string) : unit
abstract member values () : Iterator<string,obj,obj>| Assembly | Xantham.Fable.Node |
| Implements | (string * string) seq |
The MIMEParams API provides read and write access to the parameters of a MIMEType.
@since v19.1.0, v18.13.0
Methods
abstract member entries () : Iterator<(string * string),obj,obj>
abstract member entries () : Iterator<(string * string),obj,obj>Returns an iterator over each of the name-value pairs in the parameters. Each item of the iterator is a JavaScript Array. The first item of the array is the name, the second item of the array is the value.
abstract member get (name: string) : string option
abstract member get (name: string) : string optionReturns the value of the first name-value pair whose name is name. If there are no such pairs, null is returned.
Returns. or null if there is no name-value pair with the given name.
abstract member has (name: string) : bool
abstract member has (name: string) : boolReturns true if there is at least one name-value pair whose name is name.
abstract member keys () : Iterator<string,obj,obj>
abstract member keys () : Iterator<string,obj,obj>Returns an iterator over the names of each name-value pair.
import { MIMEType } from 'node:util';
const { params } = new MIMEType('text/plain;foo=0;bar=1');
for (const name of params.keys()) {
console.log(name);
}
// Prints:
// foo
// bar
abstract member set (name: string, value: string) : unit
abstract member set (name: string, value: string) : unitSets the value in the MIMEParams object associated with name to value. If there are any pre-existing name-value pairs whose names are name, set the first such pair's value to value.
import { MIMEType } from 'node:util';
const { params } = new MIMEType('text/plain;foo=0;bar=1');
params.set('foo', 'def');
params.set('baz', 'xyz');
console.log(params.toString());
// Prints: foo=def;bar=1;baz=xyz