user20934331
user20934331

Reputation: 21

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

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

Upvotes: 1

Views: 432

Answers (1)

user20934331
user20934331

Reputation: 21

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

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

did the trick.

Upvotes: 1

Related Questions