I have a GET request to a 3rd Party API which following authentication via a Token, serves a file for download within my Node.js page.
The response is as below
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 1374268
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Expires: -1
Server: Microsoft-IIS/10.0
Content-Disposition: attachment; filename=Service.docx
X-AspNet-Version: 4.0.30319
Request-Context: appId=cid-v1:1b8206f4-419d-4fa8-90d9-a200e9b5aa03
Access-Control-Expose-Headers: Request-Context
X-Powered-By: ASP.NET
Date: Sun, 08 Aug 2021 17:06:23 GMT
Connection: close
and then all the binary data in the data {} …
I am struggling to find a way to allow the file to be downloaded within my page design.
The Server Action runs fine, but how do I save the generated data into a file and download?
Thanks for the link @mebeingken
I’ve just installed the custom extension and see how it handles file uploads.
But I only need to download binary files that are served through the API and cannot get my head around it.
The link Ken has shared is for uploading a binary file. You need to create a custom module to handle the binary file and save it on server. Then, use Wappler File Download to download the file on client side.
Wappler just works with JSON API request & responses. Anything else needs custom handling.