如何在表单数据node.js模块中等待管道完成? [英] How to wait for the pipe to finish in form-data node.js module?

查看:68
本文介绍了如何在表单数据node.js模块中等待管道完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用node.js中的表单数据模块,您可以执行此操作

Using the form-data module in node.js, you can do this

form.pipe(request)

将表单数据放入请求中.但是,如何等待它完成呢?是否有这样的回调

to put the form data to the request. But how can you wait until it is complete? Is there a callback like this

form.pipe(request).done(function(err) {});

有人知道吗?

谢谢

推荐答案

在文档中,他们使用:

form.pipe(request);

request.on('response', function(res) {
  console.log(res.statusCode);
});

这篇关于如何在表单数据node.js模块中等待管道完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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