Receive File (PDF) from Server and store it locally


#1

Hey guys!
I am currently on a mission on implementing an important feature which allows people to create and share a pdf with others.
Since creating the pdf on the client seems to be too complicated, the plan (thanks @aeq) is to send the necessary text data via JSON to a node express.js server, create the pdf file and send it back to the client.

Unfortunately I am not really familiar with backend development and the fetch() api. I managed to send simple POST requests between the server and client which works perfectly however I am stuck with sending Files (in this case the PDF).

Essentially I need to receive the PDF after I sent a POST request and then store this PDF via FileStorage temporarily, get the path and then share it via the Share API.

Are here any backend-lovers who could help me out? :wink:


#2

You can send files using a text (string) in Base64.

Try use this:


#3

Thank you so much! It worked.