We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, Is it possible to use decompress in a lambda function ? I use this code but I never entered in "then" code
var obj = await s3.getObject(params2).promise(); console.log(obj.Body); decompress(obj.Body, '.').then(files => { console.log(files) files.forEach(function(val,index){ s3.putObject({ Bucket:'xxx', Key: val.path }) }); })
Best regards
The text was updated successfully, but these errors were encountered:
I succeed to do that I want !
const AWS = require('aws-sdk'); const fs = require('fs'); var decompress = require('decompress'); const s3 = new AWS.S3(); exports.handler = async (event) => { const file = decodeURIComponent(event.Records[0].s3.object.key); const srcBucket = event.Records[0].s3.bucket.name; var params = { Bucket: srcBucket, Key:file } var obj = await s3.getObject(params).promise(); var s = await decompress(obj.Body, '/tmp/').then(files => { return files; }) for(let i=0;i<s.length;i++){ await s3.upload({Bucket:'xxx',Key: s[i].path, Body: s[i].data}).promise().then(function(data) { console.log(`File uploaded successfully. ${data.Location}`); }, function (err) { console.error("Upload failed", err); }) } const response = { statusCode: 200, body: JSON.stringify('Hello from Lambda!'), }; return response; };
Sorry, something went wrong.
No branches or pull requests
Hello,
Is it possible to use decompress in a lambda function ?
I use this code but I never entered in "then" code
Best regards
The text was updated successfully, but these errors were encountered: