Laden Sie die Zeichenfolge als Datei Express JS herunter

app.get('/download', (request, response) => {
  const fileData = 'SGVsbG8sIFdvcmxkIQ=='
  const fileName = 'hello_world.txt'
  const fileType = 'text/plain'

  response.writeHead(200, {
    'Content-Disposition': `attachment; filename="${fileName}"`,
    'Content-Type': fileType,
  })

  const download = Buffer.from(fileData, 'base64')
  response.end(download)
})
yeet javascript