问题描述
是Node world的新手.
Am new to Node world.
UseCase:
从Angular接收文件之后,我正在寻找解析/处理Node上文件的最佳方法,然后在这些著名的节点模块上找到文章-multer
,multiparty
和connect-multiparty
.
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.
我发现multer
主要用于试图在磁盘存储上保存文件的情况,而这不足以满足我的用例.
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.
所以我应该忽略multer
还是实际使用它?
So should i ignore multer
or actually use it ?
我什么时候应该实际使用multiparty
和connect-multiparty
?
When should i actually use multiparty
and connect-multiparty
?
推荐答案
此问题列出了一些选项:
This question lists some of the options:
有一些模块可以直接解析多格式数据,并表示基于这些格式构建的中间件.
There are modules to parse multiform data directly, and express middleware built on top of these.
Github star最直接解析的前三个模块是可结节点(3376),busboy(814),多结节点(557).
The top three modules by Github stars for parsing directly are node-formidable (3376), busboy (814), node-multiparty (557).
顶级中间件是multer(基于2515星的busboy构建). connect-multiparty上有一条注释,建议您不要使用它. connect-busboy已经四年没有更新了.
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.
基于此,如果您想要Express中间件,我建议使用可结点的节点,busboy或multer.
Just based on this I'd suggest node-formidable, busboy, or multer if you want Express middleware.
还请注意,multer具有MemoryStorage内存存储引擎.
Also note that multer has a MemoryStorage memory storage engine.
这篇关于multer,multiparty和connect-multiparty + Nodejs之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!