【发布时间】:2019-01-16 07:22:38
【问题描述】:
有没有办法使用缓冲区数组和内容类型和 put 方法写入文件?
requestify.request('some url', {
method: 'PUT',
body: buffArray, //need modifications here
headers: {
'Content-Type': res_file.headers['content-type']
}
}).then(function (res) {
console.log(res);
})
我可以发送数据,但文件存储不正确。
工作 Java 代码
httpcon.setRequestMethod("PUT");
httpcon.setReadTimeout(100000);
httpcon.setDoOutput(true);
httpcon.setRequestProperty("Content-Type", conenttype);
httpcon.connect();
OutputStream os = httpcon.getOutputStream();
os.write(in.toByteArray(), 0, in.size());
responceCode = httpcon.getResponseCode();
httpcon.disconnect();
【问题讨论】:
-
你的服务器如何处理请求?
标签: javascript node.js stream buffer