node-request을 사용 중이며 this documentation과 같이 IBM HDFS로 파일을 보내려고합니다. 성공적으로 요청이 JSON 객체를 전달노드 요청에있는 curl --upload-file과 같은 것
는업로드 :
var options = {
method: 'put',
body: 'foo',
headers: {
'Content-Type': 'application/octet-stream',
'Transfer-Encoding': 'chunked'
}
};
그리고이 CURL 명령을 실행이 성공적으로뿐만 아니라 파일을 업로드 :
curl -v -X PUT -L -b cookie.jar "https://host:port/webhdfs/v1/tmp/myLargeFile.zip?op=CREATE&data=true" --header "Content-Type:application/octet-stream" --header "Transfer-Encoding:chunked" -T "file.txt"
를하지만, 같은 파일 스트림을 지정하려고 그래서 :
var options = {
method: 'put',
headers: {
'Content-Type': 'application/octet-stream',
'Transfer-Encoding': 'chunked'
},
multipart : [
{ body: fs.createReadStream(localFile) }
]
};
은 실패하고, 나는 어디서 잘못 될지 모른다. node-request를 사용하여 CURL에서 '--upload-file'인수를 어떻게 재현합니까?
어디에서 원격 URL에 대한 사용자 이름과 암호를 지정 하시겠습니까? –