Skip to content

Instantly share code, notes, and snippets.

@nemrosim
Created May 9, 2020 16:33
Show Gist options
  • Save nemrosim/e6a5442bcf9aa2540a45a23a0eaa18a8 to your computer and use it in GitHub Desktop.
Save nemrosim/e6a5442bcf9aa2540a45a23a0eaa18a8 to your computer and use it in GitHub Desktop.
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