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

git-clone-pack

v1.0.2

Published

Download and extract a git repository (GitHub, GitLab, Bitbucket) with modern tooling.

Readme

git-clone-pack

NPM Version NPM Downloads License TypeScript

git-clone-pack is a modern, Promise-based utility to download and extract git repositories. It serves as a robust successor to older tools, rewritten in TypeScript with modern tooling (Bun, execa) and improved error handling.

It supports downloading via HTTP download (zip) or git clone, working seamlessly with GitHub, GitLab, and Bitbucket, as well as custom repository URLs.

Features

  • 🚀 Modern & Fast: Built with TypeScript and modern Node.js APIs.
  • 📦 Promise-based: Fully async/await compatible.
  • 🛠 Flexible Strategies: Choose between downloading a zip archive (faster) or a full git clone.
  • 🌐 Multi-Provider: Native support for GitHub, GitLab, and Bitbucket.
  • 🔒 Secure: Default HTTPS protocol handling.
  • 🧹 Clean: Automatic cleanup of temporary files.
  • 📂 Filter Support: Optional extraction filtering (extract only what you need).

Installation

# npm
npm install git-clone-pack

# bun
bun add git-clone-pack

# yarn
yarn add git-clone-pack

# pnpm
pnpm add git-clone-pack

Usage

Basic Usage

import download from 'git-clone-pack';

// Download 'master' branch of a GitHub repo to './my-project'
try {
  await download('jamesishandsome/git-clone-pack', './my-project');
  console.log('Done!');
} catch (err) {
  console.error('Failed to download:', err);
}

Advanced Usage with Options

import download from 'git-clone-pack';

await download('gitlab:my-gitlab-user/my-repo#v1.0.0', './dist', {
  clone: true, // Use 'git clone' instead of zip download
  filter: (file) => file.path.endsWith('.json'), // Only extract JSON files (zip mode only)
  headers: {
    'Authorization': 'token MY_SECRET_TOKEN' // Custom headers for private repos (zip mode)
  }
});

Supported Source Formats

The repository argument accepts a shorthand string:

  • GitHub: user/repo (defaults to master/main)
  • GitHub (branch/tag): user/repo#v1.0.0
  • GitLab: gitlab:user/repo
  • Bitbucket: bitbucket:user/repo
  • Custom / Direct: direct:https://my-server.com/repo.zip (must provide full URL)

API

download(repository, destination, options?)

Downloads a git repository to the destination folder.

Arguments

  • repository string: The repository string (e.g., user/repo).
  • destination string: The local folder path to download/extract to.
  • options DownloadOptions (optional):
    • clone (boolean): If true, uses git clone. If false (default), downloads a zip archive.
    • filter (function): A function to filter files during extraction (zip mode only). Receives a file object and returns boolean.
    • headers (object): Custom HTTP headers for the request.

Returns

  • Promise<void>: Resolves when the download and extraction are complete.

License

MIT