mime.toJSON()
- 返回:<string>
mime.toString() 的别名。
【Alias for mime.toString().】
当使用 JSON.stringify() 序列化 MIMEType 对象时,将自动调用此方法。
【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"]