在 node.js 中,为什么通行证会话无法触发“文件"事件? [英] In node.js why does passport session stop formidable from triggering 'file' events?
本文介绍了在 node.js 中,为什么通行证会话无法触发“文件"事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用中我只使用
In my app I am only using
app.use(express.json());
app.use(express.urlencoded());
而不是
app.use(express.bodyParser());
以便我可以手动解析文件上传.好像这条线
so that I can manually parse file uploads. It seems that this line
app.use(passport.session());
阻止强大的触发文件事件:
stops formidable from triggering file events:
form.on('file', function(name, file) {
//never called
});
如何使用通行证会话而不与强大的文件事件发生冲突?
How can I use passport session and not clash with formidable file event?
推荐答案
看起来他们已经添加了解决此问题的方法.改用 app.use(passport.session({pauseStream: true}));
将防止异步反序列化破坏某些中间件.
Looks like they've added a way to fix this. Using app.use(passport.session({pauseStream: true}));
instead will prevent async deserializations from breaking some middleware.
来源:https://github.com/jaredhanson/passport/pull/106
这篇关于在 node.js 中,为什么通行证会话无法触发“文件"事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文