I have a query regarding downloading .rar file in S3. Here is my code. I am getting buffer data of the file but dont know how to store those buffer data in .rar file.
What actually we r doing? I am using gatsby framework and need to store the .cache and public folder to access the incremental build. We are using bitbucket pipeline but we cant update caches on the pipeline for every successful build, So we r using S3 for storing those folder as zip.
Here is my code to get object
.getObject(
{
Bucket: 'bucket-name',
Key: '.cache.rar'
},
function(error, data) {
if (error != null) {
console.log('Failed to retrieve an object: ' + error);
} else {
console.log('Loaded ' + data.ContentLength + ' bytes');
fs.writeFileSync(__dirname + '/.cache.rar', data.Body.toString());
}
}
)
.promise()
Thanks in Advance