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

baltar

v2.1.0

Published

A few small utilities for working with tarballs and http.

Readme

baltar

CI npm version node

A few small utilities for working with tarballs and http. Because you need tarballs over HTTP like:

Installation

npm install baltar

Requires Node.js >= 20.0.0

CLI Usage

# Pull and extract a tarball
baltar pull https://example.com/archive.tar.gz ./extracted

# Pull npm package (requires --strip 1)
baltar pull https://registry.npmjs.org/express/-/express-4.18.2.tgz ./express --strip 1

# Push a directory as tarball
baltar push ./myproject https://example.com/upload

# Get help
baltar --help

CLI Options

  • --strip <n>: Strip n leading directory components (pull only, use 1 for npm tarballs)
  • --tarball <path>: Save tarball to path (pull only)
  • --integrity <hash>: Verify integrity (pull only)
  • --method <method>: HTTP method (default: GET for pull, POST for push)
  • --header <header>: Add HTTP header (can be repeated)
  • --ignore <pattern>: Add ignore pattern (push only, can be repeated)

API Usage

Fetch & send tarballs over the network

baltar.pull(opts, callback)

Makes a request to opts.url and unpacks it to opts.path. Returns extracted entries via callback.

  • opts.url: {string} Location of the tarball
  • opts.headers: {Object} HTTP headers to send
  • opts.method: {string} HTTP method (default: GET)
  • opts.path: {string} Directory to unpack to
  • opts.tarball: {string} Optional path to save tarball to
  • opts.integrity: {string} Optional SRI hash for verification
  • opts.strip: {number} Optional number of leading directory components to strip (default: 0)
import { pull } from 'baltar';

// Promise-based (modern)
const entries = await pull({
  url: 'https://example.com/path/to/any/file.tgz',
  path: 'location/to/untar/into'
});

// Callback-based (legacy compatibility)
pull({
  url: 'https://example.com/path/to/any/file.tgz',
  path: 'location/to/untar/into'
}, (err, entries) => {
  if (err) throw err;
  const filenames = entries.map(e => e.path);
  console.log(filenames);
});
baltar.push(opts)

Pushes a tarball created from opts.path to opts.url. Returns a stream representing the response.

  • opts.path: Directory or file to pack
  • opts.ignoreFiles: Extra ignore patterns
  • opts.url: {string} Upload destination
  • opts.headers: {Object} HTTP headers
  • opts.method: {string} HTTP method (default: POST)
  • opts.signal: {AbortSignal} Optional abort signal
import { push } from 'baltar';

push({
  path: 'directory/or/file/to/pack',
  url: 'http://example.com/path/to/tarball/uploaded.tgz'
})
.on('error', err => console.error(err))
.on('finish', () => console.log('Upload complete'));

Pack and unpack tarballs locally

baltar.unpack(opts)

Returns a stream which unpacks into the specified opts.path.

  • opts: {Object|string} Options or path string
  • opts.path: Directory to unpack to
import { createReadStream } from 'node:fs';
import { unpack } from 'baltar';

createReadStream('path/to/any/file.tgz')
  .pipe(unpack({ path: 'location/to/untar/into' }))
  .on('entry', e => console.log('Extracting:', e.path))
  .on('done', () => console.log('Complete'));
baltar.pack(opts)

Returns a stream representing the tar.gz packed version of opts.path.

  • opts: {Object|string} Options or path string
  • opts.path: Directory or file to pack
  • opts.ignoreFiles: Extra ignore patterns
import { createWriteStream } from 'node:fs';
import { pack } from 'baltar';

pack('directory/to/pack')
  .pipe(createWriteStream('output.tgz'));

License

MIT

Author

Charlie Robbins