streaming-s3 不适用于 live -Nodejs

streaming-s3 is not working on live -Nodejs

我正在使用 streaming-s3 节点模块,它在我的本地机器上运行良好。

但在直播中它似乎不起作用。我在实时服务器上启用了 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