@elricb/find-file-up
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@elricb/find-file-up

Steps up one directory at a time searching for a file. Stops at user home directory or top of path tree. I made this to help with the dotenv package; see dotenv Usage for usage.

Requirements

  • node - recommended lts version >= 12

Install

$ npm install --save @elricb/find-file-up

Usage

import process from "process";
import path from "path";
import findFileUp from "@elricb/find-file-up";

const configPath = findFileUp(__dirname, ".env") || path.join(process.env.HOME, ".env");

console.log(configPath);

dotenv Usage

import findFileUp from "@elricb/find-file-up";

require("dotenv").config({ path: findFileUp(__dirname, ".env") || undefined });

Documentation

Release Notes

View commit tag for release notes.

API

See ./docs/index.html.

Readme

Keywords

Package Sidebar

Install

npm i @elricb/find-file-up

Weekly Downloads

1

Version

2.0.1

License

MIT

Unpacked Size

111 kB

Total Files

24

Last publish

Collaborators

  • elricb