Node.JS - S3多文件定时

时间:2018-02-12 00:36:52

标签: javascript node.js amazon-web-services amazon-s3

我的node.js项目将文本转换为mp3,将其保存到我的文件系统,然后上传到s3。我希望此函数在循环中连续运行,直到队列完成,但只有第一个文件成功上传。后续文件上传会返回此错误:import heapq heap_arr = [(1, 'a'), (2, 'b'), (2, 'b'), (3, 'c'), (3, 'd')] heapq.nlargest(2, x) # Perfectly fine - OP is [(3, 'd'), (3, 'c')] # This is similar to heapq.nlargest(2, x, key=lambda a: (a[0], a[1])) heapq.nlargest(2, x, key=lambda a: a[0]) # OP is [(3, 'c'), (3, 'd')]... Why ??

这是我的代码:

400 Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

修改

function uploadit () { console.log('uploading the verse') AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' }); var s3 = new AWS.S3(); s3.putObject({ Bucket: 'myverses', Key: book.replace(/ /g, "")+reference.replace(/ /g, "")+".mp3", Body: myvariable, ACL: 'public-read' },function (resp) { console.log(arguments); console.log('Successfully uploaded the verse.'); addanother(); });} 函数检查是否还有更多要生成和上传的文件。如果是,则执行以下代码:

addanother();

0 个答案:

没有答案