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

@stackline/git-diff-tree

v1.0.3

Published

Stream Git tree differences in Node.js while preserving the git-diff-tree event API

Readme

@stackline/git-diff-tree

Stream Git tree differences in Node.js while preserving the git-diff-tree event API.

npm version license GitHub repository Docs Reddit community

Documentation | npm | Issues | Repository

Current package version: 1.0.3


Why this package?

A scoped maintenance fork of [email protected] by Alexandru Vladutu (MIT). It preserves the event API and diff parsers while replacing deprecated stream plumbing with native Node streams, forwarding patch errors correctly and safely finishing raw-only output. Requires Node.js 18 or newer and Git on PATH. UPSTREAM.json records the exact released source and integrity.

Install with npm install @stackline/git-diff-tree and use require("@stackline/git-diff-tree"). The original API documentation follows. npm test runs the two original scenarios on Node’s test runner plus stream, UTF-8 and real Git regressions. npm run build and npm run lint validate JavaScript syntax; npm run test:package validates a fresh packed consumer install.

This package installs the verified @stackline/[email protected] maintenance fork through the git-spawned-stream alias; its existing child-process and size-limit behavior remains unchanged. The public data event continues to use two arguments (type, data).

Shelling out to git-diff-tree(1) in a Node streamy fashion.

Compatibility

| Item | Value | | --- | --- | | Package | @stackline/[email protected] | | Supported Node.js | >=18 | | Module entry | index.js (CommonJS) | | Runtime dependencies | 1 direct dependency | | External tool | Git available on PATH |

Installation

npm install @stackline/git-diff-tree

Usage

const gitDiffTree = require('@stackline/git-diff-tree');
const changes = gitDiffTree(process.cwd());
changes.on('data', (type, data) => console.log(type, data));
changes.on('error', error => { throw error; });
gitDiffTree(repoPath, [options]);

Where options defaults to:

{
  rev : 'HEAD',
  originalRev : '--root',
  // don't output data for files that have more lines changed than allowed
  MAX_DIFF_LINES_PER_FILE: 300,
  // when the diff output is bigger than the limit destroy the stream
  MAX_DIFF_SIZE: (3 * 1024 * 1024) // 3 Mb
}

Example:

var gitDiffTree = require('@stackline/git-diff-tree');
var path = require('path');
var repoPath = path.resolve(process.env.REPO || (__dirname + '/../.git'));

gitDiffTree(repoPath).on('data', function(type, data) {
  if (type === 'raw') {
    console.log('RAW DATA');
  } else if (type === 'patch') {
    console.log('PATCH DATA');
  } else if (type === 'stats') {
    console.log('FILE STATS');
  } else if (type === 'noshow') {
    console.log('Diffs not shown because files were too big');
  }
  console.log('------ \n');
  console.log(data);
  console.log('=================\n');
  // console.log(type, data);
}).on('error', function(err) {
  console.log('OH NOES!!');
  throw err;
}).on('cut', function() {
  console.log('-----------------');
  console.log('Diff to big, got cut :|');
}).on('end', function() {
  console.log('-----------------');
  console.log("That's all folks");
});

Security

Git must be available on PATH. The existing limits for total diff size and changed lines per file are retained; configure them for the repository being processed.

API Surface

The usage reference above documents the existing public API and its input/output behavior.

Local Development

Clone the repository and run the following commands from its root:

npm ci
npm run build
npm test
npm run lint

The retained upstream development notes below include historical tooling; the commands above are the maintained package checks.

Upstream tests

npm test

Consumer Smoke Test

npm run test:package packs the library and exercises an isolated consumer using the repository fixture.

Release Checklist

  1. Update the package version, lockfile, generated version fields, and changelog together.
  2. Run the development checks above and audit both npm audit and npm audit --omit=dev.
  3. Use the GitHub publish workflow with its Prod environment to publish the exact CI tarball.
  4. Verify public npm bytes, package identity, provenance, and the immutable GitHub release evidence.

License

MIT. Original copyright notices and upstream attribution are retained.

MIT

See NOTICE for retained attribution.

Credits and original authors

Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.

Community and Links

Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.