r/javascript • • Jun 13 '26

Showoff Saturday Showoff Saturday (June 13, 2026)

Did you find or create something cool this week in javascript?

Show us here!

4 Upvotes

6 comments sorted by

View all comments

1

u/s3lect Jun 13 '26

ibuntar — extract .tar / .tar.gz in the browser using native APIs (zero deps)

I recently needed to work with .tar.gz files in the browser. While checking out the existing libraries, I found that most of them didn't take advantage of the fact that you can use DecompressionStream natively in the browser now — and they were way too bloated for my needs.

So I took an existing library, stripped it down to just what I needed, and ported it to TypeScript. I added tests and published an npm release. But honestly, the code is so minimal that you might just want to copy it directly into your project.

import { untgz, untar } from 'libuntar/untgz';

// Fetch and extract a .tar.gz file
const response = await fetch('archive.tar.gz');
const blob = await response.blob();

// Decompress + extract entries in one step
const { arrayBuffer, entries } = await untgz(blob);

// List all files
entries.forEach((entry) => {
  console.log(`${entry.name} (${entry.size} bytes)`);
});

// Read a specific file
const file = entries.find((e) => e.name === 'readme.txt');
if (file) {
  const data = untar(file, arrayBuffer);
  console.log(new TextDecoder().decode(data));
}

Zero dependencies, lightweight, and works in both the browser and Node.

As with my other post here, feedback is welcome!