You should send base64 content as string in http response not as attachment and take care to transform it from vuejs controller, example below:
// php
return response()->make($base64Image);
// js -> https://stackoverflow.com/questions/14011021/how-to-download-a-base64-encoded-image
const img = api.getImage(); // base64 content
<a download="FILENAME.EXT" href="`data:image/png;base64,${img}`">Download</a>
download()
method from response()
helper expect \SplFileInfo
or string
of file path as first argument, so it can't work in your case.
/**
* Create a new file download response.
*
* @param \SplFileInfo|string $file
* @param string|null $name
* @param array $headers
* @param string|null $disposition
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function download($file, $name = null, array $headers = [], $disposition = 'attachment');