Answer the question
In order to leave comments, you need to log in
How to upload videos?
Tell me, please, how best to upload a video file from a form to the server, given that it can be of different sizes, say up to 5GB
Answer the question
In order to leave comments, you need to log in
A simple option, the entire request body is a file:
On the client, it is implemented via FileApi + Ajax
On the server, simply do request.pipe(fileWriteStream) naturally first opening the stream to the desired file
The option is a little more complicated, the body is in multipart format:
install with npm https://www .npmjs.com/package/multiparty
when requested:
1. create a form parser https://www.npmjs.com/package/multiparty#multipartyform
2. subscribe to the file event and make a pipe in it to the filestream https://www. npmjs.com/package/multiparty#file-name-file
3. submit a parsing request https://www.npmjs.com/package/multiparty#formparse...
point 2 can be omitted, if it suits us that all files fly into one folder, it is enough to give the uploadDir option at step 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question