In our case, we are going to send the file to the requesting user from our server.Īfter that we are adding the error, to check if anything suspicious happens during download from google drive. on() to handle the response in different stages.įirst, we are adding the end stage, to tell the server what to do when the file is downloaded to our server from google drive. So, in the above method, we are going to chain the then() in where we going to handle the response data from google.Īgain in the response, we are chaining some. Also we are going to set the response time as stream, so probably we are going to get the file chunk by chunk. Rember the id that we got when last time we have uploaded a file to google drive. In there we are going to pass the desired file id to download. We are going to download the file in our server via (). This function will set the directory to download the file from google drive, and another directory to serve the file to the requested user. In our express app, we are defining a get request as downloadAFile. Let's go through the code as fast as possible. get ( ' /downloadAFile ', ( req, res ) => ) Įnter fullscreen mode Exit fullscreen mode Route for downloading an image/file app.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |