req.pipe(req.busboy); 如何理解?

大家好:

我在看源码时,发现req.pipe方法,但在google上没有找到解释其具体是什么含义?(我猜是不是,多文件上传的意思?)
express API上也没有找到。

坛子里的先闻道者,麻烦帮忙下,谢谢。

code:

exports.upload = function (req, res, next) {
    req.busboy.on('file’, function (fieldname, file, filename, encoding, mimetype) {
        store.upload(file, {filename: filename}, function (err, result) {
            if (err) {
                return next(err);
            }
            res.json({
                success: true,
                url: result.url,
            });
        });
    });

    req.pipe(req.busboy);
};

阅读 11.7k
2 个回答

把HTTP理解为一个Streaming就好理解了。 是从nodejs nodejs学习资料上看到的。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进