Created
May 9, 2020 16:33
-
-
Save nemrosim/e6a5442bcf9aa2540a45a23a0eaa18a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async uploadVideo ({ request }) { | |
const video = request.file('video'); | |
await video.move(Helpers.tmpPath('uploads'), { | |
name: 'video.mp4', | |
overwrite: false, | |
}); | |
if (!video.moved()) { | |
return video.error(); | |
} | |
return 'Video file uploaded'; | |
} | |
async downloadVideo ({ params, response }) { | |
const filePath = `uploads/${params.fileName}`; | |
const isExist = await Drive.exists(filePath); | |
if (isExist) { | |
return response.download(Helpers.tmpPath(filePath)); | |
} | |
return 'File does not exist'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment