在
.attach('file', '/tmp/file')
,第一个参数是字段名(根据您的键名),第二个参数是文件路径,可以通过以下方式传递
var unirest = require('unirest');
unirest.post('http://localhost:3000/api/addProject/')
.headers({'Content-Type': 'multipart/form-data'})
.attach('html', 'D:\\data\\index.html') // Attachment
.end(function (response) {
console.log(response.body);
});