[英]How to post a file to a remote url using npm got?
I'm trying to post a file to a remote URL using npm got.我正在尝试使用 npm 将文件发布到远程 URL。 But it is not working as expected.
但它没有按预期工作。
I have tried the following我尝试了以下
const headers = {
"Content-Type": "image/png"
}
const requestProperties = {
method: 'POST',
url,
headers,
json: fs.createReadStream(file.path)
}
const response = await got(requestProperties);
Thank you!谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.