@giancarl021/locate
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

locate

Locate a file based on root of project or cwd

Installation

npm:

npm install --save @giancarl021/locate

yarn:

yarn add @giancarl021/locate

Usage

From root:

const locate = require('@giancarl021/locate');

const databasePath = locate('data/database');
// Will return <root>/data/database, independent of the file who calls it

From CWD:

const locate = require('@giancarl021/locate');

const package = locate('package.json', true);
// Will return <process.cwd()>/package.json, independent of the file who calls it

Readme

Keywords

none

Package Sidebar

Install

npm i @giancarl021/locate

Weekly Downloads

4

Version

0.1.6

License

MIT

Unpacked Size

2.47 kB

Total Files

6

Last publish

Collaborators

  • giancarl021