7
aws 서버에 파일을 업로드 할 때 nodejs를 사용하고 있습니다. 파일 크기가 올바르지 않음을 발견했습니다. 나는 2.1KB를 얻고있다. 난 내 AWS 버킷에 파일 이름을 가지고,하지만스트리밍 - s3에서 aws 파일을 올바로 사용하지 못했습니다.
여기 내 코드
var uploadFile = function (fileReadStream, awsHeader, cb) {
//set options for the streaming module
var options = {
concurrentParts: 2,
waitTime: 20000,
retries: 2,
maxPartSize: 10 * 1024 * 1024
};
//call stream function to upload the file to s3
var uploader = new streamingS3(fileReadStream, config.aws.accessKey, config.aws.secretKey, awsHeader, options);
//start uploading
uploader.begin();// important if callback not provided.
// handle these functions
uploader.on('data', function (bytesRead) {
//console.log(bytesRead, ' bytes read.');
});
uploader.on('part', function (number) {
//console.log('Part ', number, ' uploaded.');
});
// All parts uploaded, but upload not yet acknowledged.
uploader.on('uploaded', function (stats) {
//console.log('Upload stats: ', stats);
});
uploader.on('finished', function (response, stats) {
console.log(response);
cb(null, response);
});
uploader.on('error', function (err) {
console.log('Upload error: ', err);
cb(err);
});
};
입니다. 그런 다음 실패했다고하는 파일을 열려고합니다. 나는 URL에서이 파일을 업로드하려고
: https://arxiv.org/pdf/1701.00003.pdf
어떤 제안하십시오?
감사 S3에 스트림을 업로드하기위한 외부 모듈에 대한 더 이상 필요가 없습니다
: - 위의 코드를 사용하는 경우에만 해당 URL에서 문제가 발생합니다. 이제 프로젝트가 완료되었습니다. 코드를 변경하는 데 아무런 포인트가 없습니다 –
위의 코드에서 문제가 무엇인지 말해 줄 수 있습니까? –