package
A set of small and fast Node.js utilities to understand your pathing needs.
npm install empathicGitHub-flavored package documentation.
Across all versions, last 30 days.
222,535,504 in 30 days
Runtime metadata.
Estimated unpacked size across 1 packages.
21.4 kB
Includes dependencies.
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:
node:* native APIs$ npm install empathicimport { 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.
empathic/accessSource · Size:
259b
Check for file access/permissions. Named fs.accessSync shortcuts.
empathic/findFind files and/or directories by walking up parent directories.
empathic/packageConvenience helpers for dealing with package.json files and/or node_modules packages.
empathic/resolveResolve absolute paths to package identifiers, relative paths, file URL, and/or from other root directories.
empathic/walkCollect all the parent directories of a target. Controlled via cwd and last options.
MIT © Luke Edwards