# empathic

> A set of small and fast Node.js utilities to understand your pathing needs.

Latest version **2.1.0** (published 2026-09-18) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2026-09-18 |
| First published | 2024-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 0 |
| Unpacked size | 21.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 366 |
| Author | Luke Edwards |
| Maintainers | lukeed |

## Links

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

## Recent versions

- 2.1.0 (latest) — 2026-09-18
- 2.0.0-next.0 (next) — 2025-06-20
- 2.0.1 — 2026-05-07
- 2.0.0 — 2025-06-20
- 1.1.0 — 2025-04-29
- 1.0.0 — 2024-09-03
- 0.0.3 — 2024-09-03
- 0.0.2 — 2024-09-02
- 0.0.1 — 2024-09-02
- 0.0.0 — 2024-08-29

## README

# empathic [![CI](https://github.com/lukeed/empathic/workflows/CI/badge.svg)](https://github.com/lukeed/empathic/actions?query=workflow%3ACI) [![licenses](https://licenses.dev/b/npm/empathic)](https://licenses.dev/npm/empathic)

> A set of small and [fast](/benchmarks.md) Node.js utilities to understand your pathing needs.

Multiple submodules (eg, `empathic/find`) are offered, _each of which_ are:

* **fast** — 8x to 40x faster than popular alternatives
* **modern** — based on newer `node:*` native APIs
* **small** — ranging from 200b to 500b in size
* **safe** — zero-dependency & easy to read

## Install

```sh
$ npm install empathic
```

## Usage

```ts
import { resolve } from 'node:path';
import * as find from 'empathic/find';
import * as pkg from 'empathic/package';

// Assumed example structure:
let cwd = resolve('path/to/acme/websites/dashboard');

// Find closest "foobar.config.js" file
let file = find.up('foobar.config.js', { cwd });
//=> "/.../path/to/acme/foobar.config.js"

// Find closest "package.json" file
let pkgfile = pkg.up({ cwd });
//=> "/.../path/to/acme/package.json"

// Construct (optionally create) "foobar" cache dir
let cache = pkg.cache('foobar', { cwd, create: true });
//=> "/.../path/to/acme/node_modules/.cache/foobar"
```

## API

### `empathic/access`

> [Source](/src/access.ts) · **Size:** `259b`

Check for file access/permissions. Named [`fs.accessSync`](https://nodejs.org/docs/latest/api/fs.html#fsaccesssyncpath-mode) shortcuts.

### `empathic/find`

> [Source](/src/find.ts) · [Benchmark](/benchmarks.md#find) · **Size:** `569b`

Find files and/or directories by walking up parent directories.

### `empathic/package`

> [Source](/src/package.ts) · [Benchmark](/benchmarks.md#package) · **Size:** `505b`

Convenience helpers for dealing with `package.json` files and/or `node_modules` packages.

### `empathic/resolve`

> [Source](/src/resolve.ts) · [Benchmark](/benchmarks.md#resolve) · **Size:** `419b`

Resolve absolute paths to package identifiers, relative paths, file URL, and/or from other root directories.

### `empathic/walk`

> [Source](/src/walk.ts) · [Benchmark](/benchmarks.md#walk) · **Size:** `208b`

Collect all the parent directories of a target. Controlled via `cwd` and `last` options.


## License

MIT © [Luke Edwards](https://lukeed.com)

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