下载后文件为空

I'm trying to download files of different types in a database's blob column. When I open files and images, all the files are empty. What's going wrong?

$file = DB::table('files')->where('id', $fileId)->get()[0];

header("Content-length: $file->file_size");
header("Content-type: $file->file_type");
header("Content-Disposition: attachment; filename=$file->file_name");
ob_clean();
flush();
echo $file->file;

use the ready to use laravel response for file donwload

$file = DB::table('files')->where('id', $fileId)->get()[0];
return response()->streamDownload(function () use ($file) {
    echo $file->file;
}, $file->file_name);