我正在使用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的选项的更多信息

关于angularjs - streaming-s3在实时-Node.js上不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30932167/

10-10 15:51