1. 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.
true-case-path
Package: true-case-path
Created by: Profiscience
Last modified: Mon, 27 Jun 2022 21:44:27 GMT
Version: 2.2.1
License: Apache-2.0
Downloads: 10,206,198
Repository: https://github.com/Profiscience/true-case-path

Install

npm install true-case-path
yarn add true-case-path

true-case-path

TravisCI Build Status

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

Usage

 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.

 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

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

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

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

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin