Socket
Socket
Sign inDemoInstall

@giancarl021/locate

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @giancarl021/locate

Get a path from root of project or cwd


Version published
Maintainers
1
Install size
2.42 kB
Created

Readme

Source

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

FAQs

Last updated on 05 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc