'Node.JS Video Upload
Can anyone help me with video upload in Node.JS? Currently, I am using the express-fileupload module for uploading a video it works fine till 70MB but when the size increases it's not able to parse the request and the API's go on infinite loop even though I have set the limit to 100MB but the express fails to parse the request. I have added some code for reference too. Do you have any module or way from which I can limit the file size and optimize the uploading of the video so that it takes less time? P.S - I have already tried converting video to BASE-64 but the results are worse.
uploadVideo: ( options ) =>
return new Promise (resolve, reject) =>
try
if !options.files.video
reject "Video not present"
extension = {}
extension = options.files.video.mimetype
extension = extension.split('/')[1]
extension = extension.toLowerCase()
if extension != 'mp4'
reject "File format is not supported"
if options.files.video.size > 100000000
reject "File size is greater than 100 mb"
Solution 1:[1]
You may want to consider using multer to handle your file uploads.
Multer allows you to store files(images, videos, documents) in memory as a Buffer and you can then proceed to upload the file to a cloud storage of your choosing.
It can also be used to handle and store the uploaded files on your server (Disk storage) although this is less efficient for production grade setup.
I'll be glad to assist, should you need further help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lystun |