diff
npmv9.0.0TypeScriptA 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.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
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.
Dependencies
Declared by diff v9.0.0. Runtime dependencies are installed with the package; dev dependencies are not.
Dev (26)
Used by
Popular packages that depend on diff.
TypeScript execution environment and REPL for node.js, with source map support
DevTools for Rolldown
Compare items in two sequences to find a longest common subsequence
Simple XML to JavaScript object converter.
Relationship graph
Dependencies (left) and dependents (right) of diff.
Frequently installed together
Floating UI for the web
Vite DevTools Kit
Universal filesystem path utils
Graphical primitives for visualization, such as lines and areas.
Smooth scrolling for any amount of data
No description provided.
Structured diagnostic code library
Framework for building one portable devtool integration that runs in any viewer.
TypeScript definitions for node
wasm module for swc
ECMAScript parser
React is a JavaScript library for building user interfaces.
Release history
12 releases in the last two years, typically about 14 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 9.0.0latest | 4 months ago | 601 KB | BSD-3-Clause |
| 8.0.4 | 5 months ago | 507 KB | BSD-3-Clause |
| 3.5.1 | 7 months ago | 388 KB | BSD-3-Clause |
| 4.0.4 | 7 months ago | 325 KB | BSD-3-Clause |
| 4.0.3 | 7 months ago | 310 KB | BSD-3-Clause |
| 5.2.2 | 7 months ago | 420 KB | BSD-3-Clause |
| 5.2.1 | 7 months ago | 403 KB | BSD-3-Clause |
| 8.0.3 | 8 months ago | 498 KB | BSD-3-Clause |
| 8.0.2 | 1 year ago | 480 KB | BSD-3-Clause |
| 8.0.1 | 1 year ago | 502 KB | BSD-3-Clause |
| 8.0.0 | 1 year ago | 501 KB | BSD-3-Clause |
| 8.0.0-beta | 1 year ago | 501 KB | BSD-3-Clause |
| 7.0.0 | 2 years ago | 607 KB | BSD-3-Clause |
| 6.0.0 | 2 years ago | 606 KB | BSD-3-Clause |
| 6.0.0-beta | 2 years ago | 607 KB | BSD-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
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.