You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

is-path-in-cwd

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-path-in-cwd

Check if a path is in the current working directory


Version published
Weekly downloads
4.7M
decreased by-19.86%
Maintainers
1
Install size
9.35 kB
Created
Weekly downloads
 

Package description

What is is-path-in-cwd?

The is-path-in-cwd npm package is a utility that checks if a given path is inside the current working directory (CWD). This can be useful for security checks, ensuring that file operations are performed within a specific directory, or validating user input paths.

What are is-path-in-cwd's main functionalities?

Check if a path is in the current working directory

This feature allows you to check if a given path is within the current working directory. The code sample demonstrates how to use the is-path-in-cwd package to perform this check and log the result.

const isPathInCwd = require('is-path-in-cwd');

const path = './some/path';

if (isPathInCwd(path)) {
  console.log('The path is within the current working directory.');
} else {
  console.log('The path is outside the current working directory.');
}

Other packages similar to is-path-in-cwd

Readme

Source

is-path-in-cwd

Check if a path is in the current working directory

Install

$ npm install is-path-in-cwd

Usage

import isPathInCwd from 'is-path-in-cwd';

isPathInCwd('unicorn');
//=> true

isPathInCwd('../rainbow');
//=> false

isPathInCwd('.');
//=> false

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

Package last updated on 03 May 2021

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc