# lsofi

> Find processes occupying a given port

Latest version **2.0.0** (published 2026-03-13) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 58/100 (C)** — status: stable.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-03-13 |
| First published | 2016-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/lsofi) |
| Module format | ESM + CommonJS |
| Node | >=20.0.0 |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mario Nebl |
| Maintainers | marionebl |
| Keywords | tool, cli, ports, lsof, netstat |

## Links

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

## 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

- 2.0.0 (latest) — 2026-03-13
- 1.0.0 — 2016-09-05

## README

> Find processes occupying a given port

# lsofi [![stability][0]][1]

[![npm version][6]][7] [![CI][8]][9]

## Rationale

- `lsof -i :<port>` for unix, darwin and win32 alike

## Installation

```bash
npm install --save lsofi
```

## Usage

### ESM

```js
import lsofi from 'lsofi'

const occupied = await lsofi(1337)
const free = await lsofi(1338)

console.log(occupied, free)
// => 9834 null
```

### CommonJS

```js
const lsofi = require('lsofi')

const occupied = await lsofi(1337)
const free = await lsofi(1338)

console.log(occupied, free)
// => 9834 null
```

## Migration Notes

- Minimum supported Node.js version is now `20.0.0`.
- Package now ships dual entry points using `exports`:
  - `import lsofi from 'lsofi'` (ESM)
  - `require('lsofi')` (CommonJS compatibility)
- Runtime dependencies removed:
  - `is-number`: replaced with native `Number()` and `Number.isFinite()` validation.
  - `through2`: replaced with native stream parsing via `readline`.

## See also

- [krampus](https://github.com/marionebl/krampus) - Kill processes occupying a given port

---
lsofi is built by [marionebl](https://github.com/marionebl) and [contributors](https://github.com/marionebl/lsofi/graphs/contributors). It is released under the [MIT](https://github.com/marionebl/lsofi/blob/master/LICENSE) license.

[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[6]: https://img.shields.io/npm/v/lsofi.svg?style=flat-square
[7]: https://npmjs.org/package/lsofi
[8]: https://img.shields.io/github/actions/workflow/status/marionebl/lsofi/ci.yml?branch=master&style=flat-square
[9]: https://github.com/marionebl/lsofi/actions/workflows/ci.yml

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