How to wait for the pipe to finish in form-data node.js module?

萝らか妹 提交于 2019-12-24 09:50:02

问题


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) {});

Does anyone know?

Thanks


回答1:


In the docs, they use:

form.pipe(request);

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


来源:https://stackoverflow.com/questions/46479347/how-to-wait-for-the-pipe-to-finish-in-form-data-node-js-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!