npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

untar-sync

v1.0.4

Published

A JS library for extracting tar files in a synchronous manner, based on js-untar.

Readme

untar-sync

This is a library for extracting tar files in the browser or other JS environments, in a synchronous manner. It is based on js-untar.

Why not js-untar?

The original library, js-untar, always uses Web Workers when extracting files. This is useful if you are using the library on the main thread, but if you're already calling the library from within a worker, then this is redundant. In some cases, you also might want a synchronous API over an async one, such as if you are dealing with a purely synchronous code base (Emscripten projects for instance). If you are working with many small tar files, then spawning a worker for each one also introduces more overhead.

Additionally, js-untar has requirements for newer JS features such as Promises and Blobs. These might not be available in more primitive JS engines.

This library is also smaller than the original due to the removal of the promise and web worker code. The original js-untar is 2.54kb when compressed, while untar-sync is 1.53kb when compressed.

Installation

Using NPM:

npm i untar-sync

API Documentation

You may load this library using CommonJS, ES6 modules, or just a plain JS file that creates a global variable.

For example:

import untar from "untar-sync";

//load the tar file as an array buffer using any method such the fetch api
var tarFile = [...];
var files = untar(tarFile);

The untar() function always takes an ArrayBuffer as the only argument. It returns a list of File objects synchronously. No promises are used here.

Here's another example. This extracts a tar.gz by using pako to decompress it first. It loads the libraries from a CDN.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pako.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/untar.js"></script>
<script>
  var compressedTar = [...];
  var tarFile = pako.deflate(compressedTar);
  var files = untar(tarFile.buffer);
  console.log(files);
</script>

File object

This section is modified from the original js-untar documentation. The File objects in untar-sync are the same, although some utility functions have been removed.

The returned file object(s) has the following properties. Most of these are explained in the Tar wikipedia entry.

  • name = The full filename (including path and ustar filename prefix).
  • mode
  • uid
  • gid
  • size
  • mtime
  • checksum
  • type
  • linkname
  • ustarFormat
  • buffer An ArrayBuffer with the contents of the file.

If the .tar file was in the ustar format (which most are), the following properties are also defined:

  • version
  • uname
  • gname
  • devmajor
  • devminor
  • namePrefix

Additional vendor-specific PAX header fields might also be defined.

License

This library is licensed under the MIT license.