multer,multiparty和connect-multiparty + Nodejs之间的区别 [英] Difference between multer, multiparty and connect-multiparty + Nodejs

查看:572
本文介绍了multer,multiparty和connect-multiparty + Nodejs之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是Node world的新手.

Am new to Node world.

UseCase:

在Angular前端上传XLS文件有一个简单的场景, 在Node上处理它们,进行一些操作,然后将JSON保存到 Mongo DB.

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.

从Angular接收文件之后,我正在寻找解析/处理Node上文件的最佳方法,然后在这些著名的节点模块上找到文章-multermultipartyconnect-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 ?

我什么时候应该实际使用multipartyconnect-multiparty?

When should i actually use multiparty and connect-multiparty ?

推荐答案

此问题列出了一些选项:

This question lists some of the options:

如何在ExpressJS 4.x中上传文件

有一些模块可以直接解析多格式数据,并表示基于这些格式构建的中间件.

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之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆