empathic

A set of small and fast 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
$ npm install empathic
Usage
import { resolve } from 'node:path';
import * as find from 'empathic/find';
import * as pkg from 'empathic/package';
let cwd = resolve('path/to/acme/websites/dashboard');
let file = find.up('foobar.config.js', { cwd });
let pkgfile = pkg.up({ cwd });
let cache = pkg.cache('foobar', { cwd, create: true });
API
empathic/access
Source · Size: 259b
Check for file access/permissions. Named fs.accessSync shortcuts.
empathic/find
Source · Benchmark · Size: 569b
Find files and/or directories by walking up parent directories.
empathic/package
Source · Benchmark · Size: 505b
Convenience helpers for dealing with package.json files and/or node_modules packages.
empathic/resolve
Source · Benchmark · Size: 419b
Resolve absolute paths to package identifiers, relative paths, file URL, and/or from other root directories.
empathic/walk
Source · Benchmark · Size: 208b
Collect all the parent directories of a target. Controlled via cwd and last options.
License
MIT © Luke Edwards