mime.toJSON()
mime.toString()
的别名。
¥Alias for mime.toString()
.
当 MIMEType
对象用 JSON.stringify()
序列化时,会自动调用此方法。
¥This method is automatically called when an MIMEType
object is serialized
with JSON.stringify()
.
import { MIMEType } from 'node:util';
const myMIMES = [
new MIMEType('image/png'),
new MIMEType('image/gif'),
];
console.log(JSON.stringify(myMIMES));
// Prints: ["image/png", "image/gif"]
const { MIMEType } = require('node:util');
const myMIMES = [
new MIMEType('image/png'),
new MIMEType('image/gif'),
];
console.log(JSON.stringify(myMIMES));
// Prints: ["image/png", "image/gif"]