How to untar file from s3 to lambda /tmp/ folder - nodeJs

Viewed 70

I found out that lambda runtime do not consist 'tar' command. So as I can see there could be some works arount to untar file into /tmp/ folder. I tried

     const  tar  = require("tar");

     await new Promise((resolve, reject)=>{
        tar.x(  
                {
                    file: '/tmp/ZippedData/backup.tgz',
                    cwd: '/tmp/ZippedData/'
                }
             ).then(data=>{
                console.log('UNPACK', data);  // outputs undefined in AWS, but works on serverless offlinte
                resolve(data)})
      });
0 Answers
Related