Install from npm (or copy the source files directly):
npm install libuntar
import { untgz, untar } from 'libuntar/untgz';
const blob = await (await fetch('archive.tar.gz')).blob();
const { arrayBuffer, entries } = await untgz(blob);
// List entries
entries.forEach((e) => console.log(e.name, e.size, e.isFile));
// Read one file
const entry = entries.find((e) => e.name === 'readme.txt');
const text = new TextDecoder().decode(untar(entry, arrayBuffer));
import { getEntries, untar } from 'libuntar';
const arrayBuffer = await (await fetch('archive.tar')).arrayBuffer();
const entries = getEntries(arrayBuffer);
const data = untar(entries[0], arrayBuffer);
See the full README and API reference for details.