Node.js Amazon S3:在超时期间未读取或写入到服务器的套接字连接
我正在使用s3包将文件上载到s3:。 我编写了以下代码(基于代码示例): 我得到了以下错误: 无法上载:RequestTimeout:您与服务器的套接字连接 在超时期间未读取或写入。闲置的 连接将被关闭 你知道如何解决这个问题吗Node.js Amazon S3:在超时期间未读取或写入到服务器的套接字连接,node.js,sockets,amazon-s3,Node.js,Sockets,Amazon S3,我正在使用s3包将文件上载到s3:。 我编写了以下代码(基于代码示例): 我得到了以下错误: 无法上载:RequestTimeout:您与服务器的套接字连接 在超时期间未读取或写入。闲置的 连接将被关闭 你知道如何解决这个问题吗 我还查看了此链接:,但它并没有帮助我解决问题 你的档案有多大?你能用一个小文件测试你的代码吗?只是为了验证你的脚本非常小。198 Bytes我不知道第三方软件包-试试官方软件包谢谢。问题解决了。我的问题是:1。params.s3Params.key必须是S3中的对象名称
我还查看了此链接:,但它并没有帮助我解决问题 你的档案有多大?你能用一个小文件测试你的代码吗?只是为了验证你的脚本非常小。198 Bytes我不知道第三方软件包-试试官方软件包谢谢。问题解决了。我的问题是:1。params.s3Params.key必须是S3中的对象名称。2.params.localFile必须是我要上载的本地文件的路径。如果是相对路径,则必须以“./”开头
var s3 = require('s3');
var client = s3.createClient({
maxAsyncS3: 20, // this is the default
s3RetryCount: 3, // this is the default
s3RetryDelay: 1000, // this is the default
multipartUploadThreshold: 20971520, // this is the default (20 MB)
multipartUploadSize: 15728640, // this is the default (15 MB)
s3Options: {
accessKeyId: *****,
secretAccessKey: ******,
// any other options are passed to new AWS.S3()
// See: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property
},
});
var params = {
localFile: "*****",
s3Params: {
Bucket: "*****",
Key: "*****",
// other options supported by putObject, except Body and ContentLength.
// See: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property
},
};
var uploader = client.uploadFile(params);
uploader.on('error', function(err) {
console.error("unable to upload:", err.stack);
});
uploader.on('progress', function() {
console.log("progress", uploader.progressMd5Amount,
uploader.progressAmount, uploader.progressTotal);
});
uploader.on('end', function() {
console.log("done uploading");
});