I am performing the below steps in my DRF code.
- Capturing the file name in a request
- Searching the given file name in a SFTP server.
- If the file is available in SFTP server,downloading it to local path in a folder called "downloads"
- Returning the file as response with FileResponse
I need to delete the file which i downloaded from SFTP or simply delete everything in downloads folder.
What is the best approach to achieve this? How about an async celery task before returning FileResponse?
source https://stackoverflow.com/questions/70510878/how-to-handle-file-delete-after-returning-it-has-response-in-django-rest-framewo
Comments
Post a Comment