gpt4 book ai didi

angularjs - Streaming-s3 无法在实时 -Nodejs 上运行

转载 作者:太空宇宙 更新时间:2023-11-04 02:25:08 25 4
gpt4 key购买 nike

我正在使用streaming-s3 Node 模块,它在我的本地计算机上运行良好。

但在直播中它似乎不起作用。我在实时服务器上启用了 https。

如果我在实时服务器上禁用 https,我的上传工作正常。

这是我的代码

exports.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);
logger.log('info', "UPLOAD ", response);
cb(null, response);
});

uploader.on('error', function (err) {
console.log('Upload error: ', err);
logger.log('error', "UPLOAD Error: ", err);
cb(err);
});

对此有什么想法

谢谢

最佳答案

您需要在客户端中启用 ssl,添加 sslEnabled 选项,如下所示

var options = {
sslEnabled: true,
concurrentParts: 2,
waitTime: 20000,
retries: 2,
maxPartSize: 10 * 1024 * 1024
};

您可以查看有关可以使用的选项的更多信息http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html

关于angularjs - Streaming-s3 无法在实时 -Nodejs 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30932167/

25 4 0