@elricb/find-file-up
v2.0.1
Published
Steps up directories until file is found.
Downloads
3
Readme
@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
.