# is-path-inside

> Check if a path is inside another path

Latest version **4.0.0** (published 2021-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-path-inside
pnpm add is-path-inside
yarn add is-path-inside
bun add is-path-inside
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-05-03 |
| First published | 2014-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | path, inside, folder, directory, file, resolve |

## Links

- npm: https://www.npmjs.com/package/is-path-inside
- Repository: https://github.com/sindresorhus/is-path-inside
- Homepage: https://github.com/sindresorhus/is-path-inside#readme
- Issues: https://github.com/sindresorhus/is-path-inside/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/is-path-inside

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2021-05-03
- 3.0.3 — 2021-03-08
- 3.0.2 — 2019-09-30
- 3.0.1 — 2019-07-05
- 3.0.0 — 2019-07-05
- 2.1.0 — 2019-04-15
- 2.0.0 — 2018-03-22
- 1.0.1 — 2017-11-30
- 1.0.0 — 2014-08-14
- 0.1.0 — 2014-06-20

## README

# is-path-inside

> Check if a path is inside another path

## Install

```
$ npm install is-path-inside
```

## Usage

```js
import isPathInside from 'is-path-inside';

isPathInside('a/b/c', 'a/b');
//=> true

isPathInside('a/b/c', 'x/y');
//=> false

isPathInside('a/b/c', 'a/b/c');
//=> false

isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus');
//=> true
```

## API

### isPathInside(childPath, parentPath)

Note that relative paths are resolved against `process.cwd()` to make them absolute.

**Important:** This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system.

#### childPath

Type: `string`

The path that should be inside `parentPath`.

#### parentPath

Type: `string`

The path that should contain `childPath`.

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-is-path-inside?utm_source=npm-is-path-inside&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

---
_Source: https://npm.io/package/is-path-inside · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
