Open Vitolete opened 3 weeks ago
Hey, don't know if you still need this, but my guess is that if you're doing this based on responseContent
, it's possible the response body might already have been decoded as text, hence the corruption. You may need to capture the raw response bytes.
Just checked, and yes, that's what's happening. In makeAPICall
, we call Response.text()
on the fetch response, which decodes it as a UTF-8 string.
If you want the raw body, you need to edit this to response.blob()
.
What you mentioned about providing the option to download sounds like a good feature. I can't commit to making any changes to this right now, though. Please send in a PR if you can!
Scribe version
4.37
Your question
Hello, I just wanted to know if there is any way to download a zip file that comes in binary format and is obtained from a Laravel API response using response()->download().
I have tried doing it with FileSaver and transforming it to a Blob, but the downloaded files are corrupted.
In Swagger there's an option that creates a link to download the file, and it works correctly.
Thank you and best regards.
Docs