在纽曼电话会议中合并发送和下载邮递员选项的机制是什么?
我的REST调用输出是文件(图像/二进制)。与纽曼一起跑步时,我看不到输出。有没有办法将内容保存在文件中。
答案 0 :(得分:3)
var i = 0,
fs = require('fs'),
newman = require('newman'); // ensure that you have run "npm i newman" in the same directory as this file
newman.run({
// run options go here
}, function (err, summary) {
// handle collection run err, process the run summary here
}).on('request', function (err, execution) { // This is triggered when a response has been recieved
if (err) { return console.error(err); }
fs.writeFile(`response${i++}.txt`, execution.response.stream, function (error) {
if (error) { console.error(error); }
});
});