</>PackageGraphPackageGraph

diff

npmv9.0.0TypeScript

A JavaScript text diff implementation.

Safe to adopt

Yes — diff scores well across adoption, maintenance, weight, supply chain, and licensing. 124.1M downloads per week and 4 known dependents. Last published 149 days ago. 12 releases in the last 2 years.

  • AAdoption: grade A, Excellent.

    124.1M downloads per week and 4 known dependents.

  • BMaintenance: grade B, Good.

    Last published 149 days ago. 12 releases in the last 2 years.

  • AWeight: grade A, Excellent.

    Zero runtime dependencies, about 601 KB installed.

  • ASupply chain: grade A, Excellent.

    No install scripts, 2 maintainers, and a contained dependency surface.

  • ALicense: grade A, Excellent.

    BSD-3-Clause — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding diff to a project.

0
Direct dependencies

Runtime packages this one declares itself.

0
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

601 KB
Install size

Unpacked size of this package plus its entire runtime tree.

Tree depth

Longest resolved dependency chain below this package.

Compatibility

Node.js
node >=0.3.1
Module format
ESM + CommonJS
TypeScript
Types included
Install scripts
None

Quick start

A usage example from the diff README.

import {diffChars, createPatch} from 'diff';

diff vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
diffthis page124.1M4BSD-3-Clause4 months ago
leven02MIT1 day ago
jsesc01MIT1 day ago
type-fest337.8M6(MIT OR CC0-1.0)1 day ago
postcss249.3M7MIT1 day ago
csstype142.8M2MIT1 day ago

Dependencies

Declared by diff v9.0.0. Runtime dependencies are installed with the package; dev dependencies are not.

Dev (26)

@arethetypeswrong/cli ^0.18.2@babel/core ^7.29.0@babel/preset-env ^7.29.2@babel/register ^7.28.6@colors/colors ^1.6.0@eslint/js ^10.0.1babel-loader ^10.1.1babel-plugin-istanbul 8.0.0chai ^6.2.2cross-env ^10.1.0eslint ^10.2.0globals ^17.5.0karma ^6.4.4karma-mocha ^2.0.1karma-mocha-reporter ^2.2.5karma-sourcemap-loader ^0.4.0karma-webpack ^5.0.1mocha ^11.7.5nyc ^18.0.0rollup ^4.60.1tsd ^0.33.0typescript ^6.0.2typescript-eslint ^8.58.1uglify-js ^3.19.3webpack ^5.106.1webpack-dev-server ^5.2.3

Used by

Popular packages that depend on diff.

Relationship graph

Dependencies (left) and dependents (right) of diff.

Frequently installed together

Release history

12 releases in the last two years, typically about 14 days apart.

Recent versions of diff
VersionPublishedSizeLicense
9.0.0latest4 months ago601 KBBSD-3-Clause
8.0.45 months ago507 KBBSD-3-Clause
3.5.17 months ago388 KBBSD-3-Clause
4.0.47 months ago325 KBBSD-3-Clause
4.0.37 months ago310 KBBSD-3-Clause
5.2.27 months ago420 KBBSD-3-Clause
5.2.17 months ago403 KBBSD-3-Clause
8.0.38 months ago498 KBBSD-3-Clause
8.0.21 year ago480 KBBSD-3-Clause
8.0.11 year ago502 KBBSD-3-Clause
8.0.01 year ago501 KBBSD-3-Clause
8.0.0-beta1 year ago501 KBBSD-3-Clause
7.0.02 years ago607 KBBSD-3-Clause
6.0.02 years ago606 KBBSD-3-Clause
6.0.0-beta2 years ago607 KBBSD-3-Clause

Overview

diff is an npm package that a JavaScript text diff implementation. It is extremely widely used, with about 124.1M downloads per week and 4 known dependents in the graph. The latest version is 9.0.0, released under the BSD-3-Clause license.

Who should use it

Teams working in the npm ecosystem who need a JavaScript text diff implementation and value a battle-tested, widely-adopted solution.

When not to use it

Consider an alternative if you need to minimize your dependency tree, or if a more actively-maintained option better fits your npm stack.

Pros

  • Large, well-established user base (124.1M weekly downloads).
  • Ships TypeScript type definitions.
  • Clear open-source license (BSD-3-Clause).

Cons

  • Large dependency tree (26 direct dependencies) increases install size and audit surface.

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Keywords

Frequently asked questions

Should I use diff?

Yes — diff scores well across adoption, maintenance, weight, supply chain, and licensing. 124.1M downloads per week and 4 known dependents. Last published 149 days ago. 12 releases in the last 2 years.

How do I install diff?

Run `npm install diff` to add diff to your npm project.

What license is diff released under?

diff is distributed under the BSD-3-Clause license.

How popular is diff?

diff has approximately 124,141,695 downloads per week and 4 known dependent packages.

Is diff still maintained?

The most recent release of diff (v9.0.0) was published 4 months ago.

Does diff run install scripts?

No. diff does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.