https://github.com/pa-bru/get-file-path
get a file path from an initial path
https://github.com/pa-bru/get-file-path
file filepath get path
Last synced: 8 months ago
JSON representation
get a file path from an initial path
- Host: GitHub
- URL: https://github.com/pa-bru/get-file-path
- Owner: pa-bru
- License: mit
- Created: 2018-12-21T10:19:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-27T11:23:58.000Z (over 7 years ago)
- Last Synced: 2025-07-02T04:05:53.188Z (12 months ago)
- Topics: file, filepath, get, path
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# get-file-path
[![npm version][npm-badge]][npm]
Retrieve a file path from an initial path.
A common example is to get the path of a package.json.
**How it works?**
If the file isn't at the initial path, it will search in the parent folder, etc.
## Installation
```shell
npm i get-file-path
```
## Usage
```js
getFilePath(initialPath, fileToReach)
```
> By default `fileToReach` is `package.json`
e.g
```js
import getFilePath from "get-file-path"
const packagePath = getFilePath("./", "package.json")
// packagePath: '/Users/username/Desktop/getFile/package.json'
```
## License
get-file-path is [MIT-licensed].
[npm-badge]: https://badge.fury.io/js/get-file-path.svg
[npm]: https://www.npmjs.com/package/get-file-path