标签:ios oca host for pictures 使用 formdata end creat
yarn add form-data
(async () => {
const l = console.log;
const axios = require("axios");
const fs = require("fs-extra");
var FormData = require("form-data");
var form = new FormData();
form.append("file", fs.createReadStream("C:\\Users\\Administrator\\Pictures\\a.jpg"));
form.append("type", "avatar");
let r = await axios({
method: "post",
url: "http://localhost:5000/upload",
data: form,
headers: form.getHeaders()
}).then(v => v.data);
l(r); // ok
})();
标签:ios oca host for pictures 使用 formdata end creat
原文地址:https://www.cnblogs.com/ajanuw/p/9822880.html