Difference between multer, multiparty and connect-multiparty + Nodejs

BeingSuman picture BeingSuman · Oct 18, 2016 · Viewed 11.2k times · Source

Am new to Node world.

UseCase :

Was having a simple scenario of uploading XLS files on Angular front, process them on Node, make some manipulations and then save JSON on to Mongo DB.

After receiving files from Angular, i was searching what is the best way to parse / process a file on Node and then came across articles on these famous node modules - multer, multiparty and connect-multiparty.

Every article explains how to use corresponding module and couldn't find any one telling which one to be used when.

I found that multer is mainly used when you are trying to save a file on Disk Storage and that doesn't suffice my use case.

So should i ignore multer or actually use it ?

When should i actually use multiparty and connect-multiparty ?

Answer

Simon D picture Simon D · Nov 27, 2016

This question lists some of the options:

How could I upload files in ExpressJS 4.x

There are modules to parse multiform data directly, and express middleware built on top of these.

The top three modules by Github stars for parsing directly are node-formidable (3376), busboy (814), node-multiparty (557).

The top middleware is multer (built on busboy, 2515 stars). connect-multiparty has a note suggesting not to use it. connect-busboy has not been updated in four years.

Just based on this I'd suggest node-formidable, busboy, or multer if you want Express middleware.

Also note that multer has a MemoryStorage memory storage engine.