Javascript web browser based tool to extract local files from gzip (tgz)

233 Views Asked by At

As part of a bigger log file analysis tool that I want to write in Javascript I need to extract text files (log files) from a tgz archive that are on the local hard drive.

I have a html page with a drag n drop field which provides the file in JS. I understood there is a decompression API in modern web browsers that I can use to decompress the gzip portion. My problem is: I cannot use the pipeThrough function on a file. What is the most efficient way to do what I want to do? Thanks

1

There are 1 best solutions below

1
user20934331 On

Sometimes it helps to write down the problem to solve it yourself :)

const decompressedReadableStream = file.stream().pipeThrough(new DecompressionStream('gzip'));

did the trick.