有这个module.exports从 API 端点获取图像的文件。然后将 API 结果解析为 blob。解析后的 Blob 对象如下所示:
Blob {
[Symbol(type)]: 'image/jpeg',
[Symbol(buffer)]:
<Buffer ff d8 ff db 00 43 00 08 06 06 07 06 05 08 07 07 07 09 09 08 0a 0c 14
0d 0c 0b 0b 0c 19 12 13 0f 14 1d 1a 1f 1e 1d 1a 1c 1c 20 24 2e 27 20 22 2c 23 1c
... > }
Run Code Online (Sandbox Code Playgroud)
这是代码:
// Pre Configuration
const fetch = require('node-fetch')
module.exports = async …Run Code Online (Sandbox Code Playgroud)