# libnpmfund

> Programmatic API for npm fund

Latest version **8.0.2** (published 2026-07-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install libnpmfund
pnpm add libnpmfund
yarn add libnpmfund
bun add libnpmfund
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 8.0.2 |
| Published | 2026-07-29 |
| First published | 2020-06-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^22.22.2 \|\| ^24.15.0 \|\| >=26.0.0 |
| Dependencies | 1 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10108 |
| Author | GitHub Inc. |
| Maintainers | saquibkhan, npm-cli-ops, reggi |
| Keywords | npm, npmcli, libnpm, cli, git, fund, gitfund |

## Links

- npm: https://www.npmjs.com/package/libnpmfund
- Repository: https://github.com/npm/cli
- Homepage: https://github.com/npm/cli#readme
- Issues: https://github.com/npm/cli/issues
- npm.io page: https://npm.io/package/libnpmfund

## Dependencies (1)

- [@npmcli/arborist](https://npm.io/package/@npmcli/arborist.md) ^10.0.2

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 8.0.2 (latest) — 2026-07-29
- 7.0.26 (backport) — 2026-07-29
- 8.0.0-pre.1 (prerelease) — 2026-06-29
- 8.0.1 — 2026-07-10
- 8.0.0 — 2026-07-08
- 7.0.25 — 2026-06-29
- 8.0.0-pre.0 — 2026-06-19
- 7.0.24 — 2026-06-11
- 7.0.23 — 2026-05-27
- 7.0.20-pre.0.0 — 2026-05-20
- 7.0.22 — 2026-05-20
- 7.0.21 — 2026-05-06
- 7.0.20 — 2026-04-22
- 6.0.5 — 2026-03-27
- 6.0.4 — 2026-03-18
- … 88 more at https://npm.io/package/libnpmfund/versions

## README

# libnpmfund

[![npm version](https://img.shields.io/npm/v/libnpmfund.svg)](https://npm.im/libnpmfund)
[![license](https://img.shields.io/npm/l/libnpmfund.svg)](https://npm.im/libnpmfund)
[![CI - libnpmfund](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml)

[`libnpmfund`](https://github.com/npm/libnpmfund) is a Node.js library for
retrieving **funding** information for packages installed using
[`arborist`](https://github.com/npm/arborist).

## Table of Contents

* [Example](#example)
* [Install](#install)
* [Contributing](#contributing)
* [API](#api)
* [LICENSE](#license)

## Example

```js
const { read } = require('libnpmfund')

const fundingInfo = await read()
console.log(
  JSON.stringify(fundingInfo, null, 2)
)
// => {
  length: 2,
  name: 'foo',
  version: '1.0.0',
  funding: { url: 'https://example.com' },
  dependencies: {
    bar: {
      version: '1.0.0',
      funding: { url: 'http://collective.example.com' }
    }
  }
}
```

## Install

`$ npm install libnpmfund`

### Contributing

The npm team enthusiastically welcomes contributions and project participation!
There's a bunch of things you can do if you want to contribute! The
[Contributor Guide](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md)
outlines the process for community interaction and contribution. Please don't
hesitate to jump in if you'd like to, or even ask us questions if something
isn't clear.

All participants and maintainers in this project are expected to follow the
[npm Code of Conduct](https://www.npmjs.com/policies/conduct), and just
generally be excellent to each other.

Please refer to the [Changelog](CHANGELOG.md) for project history details, too.

Happy hacking!

### API

##### <a name="fund.read"></a> `> fund.read([opts]) -> Promise<Object>`

Reads **funding** info from a npm install and returns a promise for a
tree object that only contains packages in which funding info is defined.

Options:

- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over
any obj definition and just returns an obj containing `{ length }` - useful for
things such as printing a `6 packages are looking for funding` msg.
- `workspaces`: `Array<String>` List of workspaces names to filter for,
the result will only include a subset of the resulting tree that includes
only the nodes that are children of the listed workspaces names.
- `path`, `registry` and more [Arborist options](https://github.com/npm/cli/blob/latest/workspaces/arborist/README.md#usage).

##### <a name="fund.readTree"></a> `> fund.readTree(tree, [opts]) -> Promise<Object>`

Reads **funding** info from a given install tree and returns a tree object
that only contains packages in which funding info is defined.

- `tree`: An [`arborist`](https://github.com/npm/cli/blob/latest/workspaces/arborist/README.md) tree to be used, e.g:

```js
const Arborist = require('@npmcli/arborist')
const { readTree } = require('libnpmfund')

const arb = new Arborist({ path: process.cwd() })
const tree = await arb.loadActual()

return readTree(tree, { countOnly: false })
```

Options:

- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over
any obj definition and just returns an obj containing `{ length }` - useful for
things such as printing a `6 packages are looking for funding` msg.

##### <a name="fund.normalizeFunding"></a> `> fund.normalizeFunding(funding) -> Object`

From a `funding` `<object|string|array>`, retrieves normalized funding objects
containing a `url` property.

e.g:

```js
normalizeFunding('http://example.com')
// => {
  url: 'http://example.com'
}
```

##### <a name="fund.isValidFunding"></a> `> fund.isValidFunding(funding) -> Boolean`

Returns `<true>` if `funding` is a valid funding object, e.g:

```js
isValidFunding({ foo: 'not a valid funding obj' })
// => false

isValidFunding('http://example.com')
// => true
```

## LICENSE

[ISC](./LICENSE)

---
_Source: https://npm.io/package/libnpmfund · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
