I have a gz file stored in S3. I am trying to use pako to decompress the file. Here's the code that I have written:
s3.getObject({ Bucket:srcBucket, Key:decodedSrcKey }, function(err,data){
if (err){
console.log('Error in getting object '+err);
}
else{
try{
var decompressedFile = pako.inflate(data.Body);
}catch(err){
console.log('ERROR in decompressing'+err);
}
console.log('Decompressed File'+decompressedFile);
}
});
There is no error that is displayed in logs. But the code never reaches the line where I try to decompress data using inflate function. I tried outputting data.Body and I got the following output, which looks correct:
Body: < Buffer 1f 8b 08 00 00 00 00 00 00 03 ec bd cd 92 ea c8 93 2f b8 d6 7d 0a ad fa 56 99 65 9e d6 37 b0 74 a4 48 29 12 29 82 0a 49 70 c8 4d ad a6 57 d7 6c cc c6 fa ... >
How do I uncompress the gz file stored in S3?
Aucun commentaire:
Enregistrer un commentaire