# true-case-path

> Given a possibly case-variant version of an existing filesystem path, returns the case-exact, normalized version as stored in the filesystem.

Latest version **2.2.1** (published 2019-07-24) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install true-case-path
pnpm add true-case-path
yarn add true-case-path
bun add true-case-path
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2019-07-24 |
| First published | 2016-02-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | barsh |
| Maintainers | barsh |

## Links

- npm: https://www.npmjs.com/package/true-case-path
- Repository: https://github.com/Profiscience/true-case-path
- Homepage: https://github.com/Profiscience/true-case-path#readme
- Issues: https://github.com/Profiscience/true-case-path/issues
- npm.io page: https://npm.io/package/true-case-path

## Recent versions

- 2.2.1 (latest) — 2019-07-24
- 2.2.0 — 2019-07-24
- 2.0.0 — 2019-04-26
- 1.0.3 — 2018-08-26
- 1.0.2 — 2016-02-23
- 1.0.1 — 2016-02-10
- 1.0.0 — 2016-02-10

## README

# true-case-path

[![TravisCI Build Status][travis-ci-shield]][travis-ci]

> Given a possibly case-variant version of an existing filesystem path, returns the absolute, case-exact, normalized version as stored in the filesystem.

## Usage

```typescript
const { trueCasePath, trueCasePathSync } = require('true-case-path')

trueCasePath(<fileSystemPath>)
    .then((caseCorrectPath) => {
        // ...
    })

const caseCorrectPath = trueCasePathSync(<fileSystemPath>)
```

> **NOTE**: If no matching path exists, an error with be thrown.

---

Optionally takes a second argument to use as the base path to begin case-correction from. This can be particularly useful within shared hosting environments since true-case-path relies on the ability to list a directory's contents in order to check the case and attempting to list the contents of `/` or `/home` will generally result in a permissions error.

```typescript
const { trueCasePath } = require('true-case-path')

trueCasePath('code/my-app/sOmE-FiLe', '/home/casey')
```

> **NOTE**: When specifying a basePath, the first argument is expected to be the file path _relative to that basePath_. If the first argument is absolute, every path segment will be checked. basePath defaults to `process.cwd()` if not specified and the first argument is relative.

## Platforms

Windows, OSX, and Linux

## Examples

```typescript
const { trueCasePathSync } = require('true-case-path')

trueCasePathSync('/users/guest') // OSX: -> '/Users/Guest'

trueCasePathSync('c:\\users\\all users') // Windows: -> 'c:\Users\All Users'
```

[travis-ci]: https://travis-ci.org/Profiscience/true-case-path
[travis-ci-shield]: https://img.shields.io/travis/Profiscience/true-case-path/master.svg

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