const key = `
---start---
xxxxxxx
---end---
`
const blob = new Blob([key], {
type: 'application/x-pem-file',
})
const a = document.createElement('a')
a.href = window.URL.createObjectURL(blob)
a.download = 'key.pem'
a.style.display = 'none'
document.body.appendChild(a)
a.click()
大概代码如上,key 是 String 格式
下载完文件格式就变成 key.cer
求解