shelfio/libreoffice-lambda-layer

How to unpack lo.tar.br using brotli?

Jun711 opened this issue · 1 comments

Hi, I tried to use Nodejs brotli to unpack the lo.tar.br file but I am not sure how to use it. After zlib.brotliDecompress, the tar.br file is still not unpacked.
Could you please provide an example? Thank you

What I tried

const libreOfficePacked = fs.readFileSync('/tmp/lo.tar.br')
zlib.brotliDecompress(libreOfficePacked)

https://nodejs.org/api/zlib.html#zlibbrotlidecompressbuffer-options-callback

zlib.brotliDecompress(buffer[, options], callback)

From brotli npm doc,

// decode a buffer where the output size is known
brotli.decompress(compressedData, uncompressedLength);
 
// decode a buffer where the output size is not known
brotli.decompress(fs.readFileSync('compressed.bin'));