A
A
Alex2016-12-13 00:01:03
Node.js
Alex, 2016-12-13 00:01:03

How to upload and process multiple files in node. js?

I swim very strongly in this matter. The point is the following.
You need to transfer two files to the node.js server. It must process their content and send a third file to the browser.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Rulev, 2016-12-19
@Rulexec

You need to use something to handle multipart/form-data like node-multiparty . There , streams will come in the part
event , you will need to copy their contents into a list in the table filename → list of pieces . Then, at the end of the request, calculate the total resulting length of files in each list, make such a buffer, copy everything into one, process it as you like. It is trivial to send - keep a link to the response, as you have finished processing - you can write the answer there. Only if you have non-text files and want it to be automatically downloaded and not shown in the browser, set the response header to application/octet-stream .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question