{"_id":"is-fs-case-sensitive","_rev":"4-eebfc086c8827c594925d05409c652a5","name":"is-fs-case-sensitive","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"is-fs-case-sensitive","version":"1.0.0","keywords":["fs","promise","promises","exists"],"author":{"name":"Hiroki Osame","email":"hiroki.osame@gmail.com"},"license":"MIT","_id":"is-fs-case-sensitive@1.0.0","maintainers":[{"name":"hirokiosame","email":"hiroki.osame@gmail.com"}],"homepage":"https://github.com/privatenumber/is-fs-case-sensitive#readme","bugs":{"url":"https://github.com/privatenumber/is-fs-case-sensitive/issues"},"dist":{"shasum":"cdd715234b9c3442d2124d4aa28aa794409940cd","tarball":"https://registry.npmjs.org/is-fs-case-sensitive/-/is-fs-case-sensitive-1.0.0.tgz","fileCount":7,"integrity":"sha512-hyEEHrtR68ooLwGLgdf3bTXZ5u2mHg7TUhmQDm3Zc+06dURnKTUNXah6jgg/qjK/kuSFjCbJGEJCmXgXYfOerw==","signatures":[{"sig":"MEUCIQC8wL7S0RtKecdst6AMZ5IT502RDRWHjDs3/4/55EudiwIgIJ3GN3u+ra+W9mnp/GsVDgnwzlcAFDnu6eVvsOaHr9Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj328cACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq2Lg/+KH/YhXhJHgM1oK39/fAAJkV97k7ro95VZ9GOIFG9GVKuAE3o\r\nYxIoEZTEA3Qr1nQg+DtE2Lgn8AkwLxuDTGSOR8G08YRLZEbinJ0OJEnJRzAT\r\n65otSfbllkQWZr3LLG0MHWCh8k5aSOq6JmhK9g/WzW4ptNhYZfH0XR6+oAlX\r\nJRnrX6sOj5J8XnVzmNSdf0cv7Mk3IggQbebbN8YiVqs+CijNeRU10QVDnrfc\r\n7tlgDE0grbGGhJWpu1retkO17NcOGohDn3xA85DYTWvXV7Fu2BlgxrTqRKMj\r\ntOJ/X7mg2ODzXEmyvyb9b2c8dTi+cfz/ig3XRiDuDuQ5UF1Ilwe6aNtad0q5\r\naj3KKgwhhBwzW6MT5zm9GG9pie0LouKtJhy0tCvjNj2HAEfRIVlKUCGL1Dxh\r\nxp2nKwTbq/j53MJQfJGU6mOkUHuu96NnLYSiN1nT2qcwEWx0kOL17oyFxUhT\r\nHeHf4GacO9tMra1aSzgvv2Ky47Y5do4sbI93V+GlQ+dNjEubIh0QZo9UMU+a\r\nuK9evabQRutKAPm+D5OghhDMVhAvQV374C0texUQF14xn+jLwRXbkLa0bsZV\r\n3zhVPlxWL4qMzVxQXjIeLmeKgZS0gdPY+z7nXunL8xNoAwme/Bc3o/Ujtw2G\r\nWBx9PhpqAOPMlmi1rbJs9XCFHGTn/6knn+U=\r\n=ya8r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.cts","module":"./dist/index.mjs","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"funding":"https://github.com/privatenumber/is-fs-case-sensitive?sponsor=1","gitHead":"4eed637b5ab43b3c22ca6dbc3172ae7410fa0f2f","imports":{"#is-fs-case-sensitive":{"types":"./src/index.ts","default":"./dist/index.mjs","development":"./src/index.ts"}},"_npmUser":{"name":"hirokiosame","email":"hiroki.osame@gmail.com"},"repository":{"url":"git+https://github.com/privatenumber/is-fs-case-sensitive.git","type":"git"},"_npmVersion":"8.19.2","description":"The missing is-fs-case-sensitive()","directories":{},"_nodeVersion":"18.12.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/is-fs-case-sensitive_1.0.0_1675587356538_0.36805808195223144","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"is-fs-case-sensitive","version":"1.0.1","keywords":["fs","case","sensitive","insensitive"],"author":{"name":"Hiroki Osame","email":"hiroki.osame@gmail.com"},"license":"MIT","_id":"is-fs-case-sensitive@1.0.1","maintainers":[{"name":"hirokiosame","email":"hiroki.osame@gmail.com"}],"homepage":"https://github.com/privatenumber/is-fs-case-sensitive#readme","bugs":{"url":"https://github.com/privatenumber/is-fs-case-sensitive/issues"},"dist":{"shasum":"d3f6f88006f3c67773a8e76c5176ebcd6fa78c88","tarball":"https://registry.npmjs.org/is-fs-case-sensitive/-/is-fs-case-sensitive-1.0.1.tgz","fileCount":7,"integrity":"sha512-Fwi9AoVbuFus9d6Sidq5ch/Zeaq25FO5x7XOiTknVGPThqhijKw1rlwpZ28byQ3FpGf7yPq/GP91PNOzoqVJJQ==","signatures":[{"sig":"MEUCIFjqodcfDwrB3qlqcz6+c6ognw952ScSqrXT74r7UkLFAiEA9C+L/pvhbJRewpU8Oox9P+copUTMjMrkjH9j4NYG3oU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7324},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.cts","module":"./dist/index.mjs","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"funding":"https://github.com/privatenumber/is-fs-case-sensitive?sponsor=1","gitHead":"b82a182aa60b42f2364f8c1bd3a754a9e5068419","imports":{"#is-fs-case-sensitive":{"types":"./src/index.ts","default":"./dist/index.mjs","development":"./src/index.ts"}},"_npmUser":{"name":"hirokiosame","email":"hiroki.osame@gmail.com"},"repository":{"url":"git+https://github.com/privatenumber/is-fs-case-sensitive.git","type":"git"},"_npmVersion":"10.9.3","description":"Check whether the file-system is case-sensitive","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/is-fs-case-sensitive_1.0.1_1759422285330_0.8024223157739818","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"is-fs-case-sensitive","version":"1.1.0","keywords":["fs","case","sensitive","insensitive"],"author":{"name":"Hiroki Osame","email":"hiroki.osame@gmail.com"},"license":"MIT","_id":"is-fs-case-sensitive@1.1.0","maintainers":[{"name":"hirokiosame","email":"hiroki.osame@gmail.com"}],"homepage":"https://github.com/privatenumber/is-fs-case-sensitive#readme","bugs":{"url":"https://github.com/privatenumber/is-fs-case-sensitive/issues"},"dist":{"shasum":"5982b3be2cd5ca4ef70716ec2eeac426225457a7","tarball":"https://registry.npmjs.org/is-fs-case-sensitive/-/is-fs-case-sensitive-1.1.0.tgz","fileCount":7,"integrity":"sha512-4Usqgjp3fEp9AWrW4dj8CAw0eKES9lQQu92eXBfbXByR1Vq+KRYXZczehqw/j2m/Z3cI5MjbWKV7ydxM7KW7uw==","signatures":[{"sig":"MEYCIQDenv6B4EBZ/Wwc2dFzS7oknkzMIoZ3pTIgzm+tx/E12wIhAM5AvrlNTbCoZj1Msj7DsQOnhYVyBV2qUOzPqvpbDQCm","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10368},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.cts","module":"./dist/index.mjs","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"funding":"https://github.com/privatenumber/is-fs-case-sensitive?sponsor=1","gitHead":"e1c49ff8e41639b7f11244063ae3d3092f004ae8","imports":{"#is-fs-case-sensitive":{"types":"./src/index.ts","default":"./dist/index.mjs","development":"./src/index.ts"}},"_npmUser":{"name":"hirokiosame","email":"hiroki.osame@gmail.com"},"repository":{"url":"git+https://github.com/privatenumber/is-fs-case-sensitive.git","type":"git"},"_npmVersion":"10.9.3","description":"Check whether the file-system is case-sensitive","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/is-fs-case-sensitive_1.1.0_1759566561407_0.5407889181899614","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"is-fs-case-sensitive","version":"2.0.0","description":"Check whether the file-system is case-sensitive","keywords":["fs","case","sensitive","insensitive"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/privatenumber/is-fs-case-sensitive.git"},"funding":"https://github.com/privatenumber/is-fs-case-sensitive?sponsor=1","author":{"name":"Hiroki Osame","email":"hiroki.osame@gmail.com"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.cts","exports":{"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"}},"imports":{"#is-fs-case-sensitive":{"types":"./src/index.ts","development":"./src/index.ts","default":"./dist/index.mjs"}},"_id":"is-fs-case-sensitive@2.0.0","gitHead":"57dda42908e1e988b4de615c4f737c145c2bf153","bugs":{"url":"https://github.com/privatenumber/is-fs-case-sensitive/issues"},"homepage":"https://github.com/privatenumber/is-fs-case-sensitive#readme","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-JoCsyGITdYPM+pUbeMQ4IiEuQ4wjPdeWORlG7n644isewbcxiQIr+9gmF5k7UabTP/jLBRkbgydEamR7JZBKHA==","shasum":"943c8f3140d1fb4fd7c397f159c123927b402bf4","tarball":"https://registry.npmjs.org/is-fs-case-sensitive/-/is-fs-case-sensitive-2.0.0.tgz","fileCount":7,"unpackedSize":12150,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGdYyAzGRWts7HRfZXtJmCKBZSVC+6YeczBRV2nKqFQFAiEAw4sLWWs4xe/cLl8B/ebfX0vGTDidwEuMgzwpKr69jxQ="}]},"_npmUser":{"name":"hirokiosame","email":"hiroki.osame@gmail.com"},"directories":{},"maintainers":[{"name":"hirokiosame","email":"hiroki.osame@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-fs-case-sensitive_2.0.0_1759567242097_0.43590663632731164"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-05T08:55:56.537Z","modified":"2025-10-04T08:40:42.466Z","1.0.0":"2023-02-05T08:55:56.684Z","1.0.1":"2025-10-02T16:24:45.508Z","1.1.0":"2025-10-04T08:29:21.616Z","2.0.0":"2025-10-04T08:40:42.274Z"},"bugs":{"url":"https://github.com/privatenumber/is-fs-case-sensitive/issues"},"author":{"name":"Hiroki Osame","email":"hiroki.osame@gmail.com"},"license":"MIT","homepage":"https://github.com/privatenumber/is-fs-case-sensitive#readme","keywords":["fs","case","sensitive","insensitive"],"repository":{"type":"git","url":"git+https://github.com/privatenumber/is-fs-case-sensitive.git"},"description":"Check whether the file-system is case-sensitive","maintainers":[{"name":"hirokiosame","email":"hiroki.osame@gmail.com"}],"readme":"# is-fs-case-sensitive [![Latest version](https://badgen.net/npm/v/is-fs-case-sensitive)](https://npm.im/is-fs-case-sensitive) [![Install size](https://packagephobia.now.sh/badge?p=is-fs-case-sensitive)](https://packagephobia.now.sh/result?p=is-fs-case-sensitive)\n\nDetect whether the underlying filesystem has case-sensitive file paths. A robust, zero-dependency utility for cross-platform tools.\n\n## 🤔 Why?\n\nDifferent operating systems handle filename casing differently:\n\n- **macOS (APFS):** Case-insensitive by default, but can be formatted as case-sensitive.\n- **Windows (NTFS):** Case-insensitive by default, but case-sensitivity can be enabled per-directory.\n- **Linux (ext4):** Case-sensitive by default.\n\nThis distinction is critical for tools like bundlers, linters, or test runners that need to resolve file paths consistently across different environments. This package provides a reliable, runtime check to determine the actual behavior of the filesystem where your code is running.\n\n## 🚀 Install\n\n```sh\nnpm install is-fs-case-sensitive\n````\n\n## 👨🏻‍🏫 Examples\n\n### Basic Usage\n\nCheck the current working directory's filesystem. Results are cached per-directory.\n\n```ts\nimport { isFsCaseSensitive } from 'is-fs-case-sensitive'\n\n// Check current working directory (defaults to process.cwd())\n// On a standard macOS or Windows system:\nconsole.log(isFsCaseSensitive())\n// => false\n\n// On a standard Linux system:\nconsole.log(isFsCaseSensitive())\n// => true\n```\n\n### Check Specific Directory\n\nCheck case-sensitivity of a specific directory's filesystem.\n\n```ts\nimport { isFsCaseSensitive } from 'is-fs-case-sensitive'\n\n// Check a specific directory\nconsole.log(isFsCaseSensitive('/path/to/directory'))\n// => true or false depending on that directory's filesystem\n\n// Different mount points can have different case-sensitivity\nconsole.log(isFsCaseSensitive('/home/user')) // => true (ext4)\nconsole.log(isFsCaseSensitive('/mnt/windows')) // => false (NTFS)\n```\n\n### Advanced Usage\n\nYou can provide a custom `fs` implementation and bypass the cache for testing purposes.\n\n```ts\nimport { Volume } from 'memfs'\nimport { isFsCaseSensitive } from 'is-fs-case-sensitive'\n\n// `memfs` is case-sensitive by default\nconst customFs = Volume.fromJSON({})\n\n// Pass in directory, custom fs implementation, and disable cache\nconst isSensitive = isFsCaseSensitive(undefined, customFs, false)\n\nconsole.log(isSensitive)\n// => true\n```\n\n## ⚙️ How it Works\n\nThe check detects case-sensitivity of a **specific directory's filesystem** using a fast, I/O-free primary method with a reliable fallback.\n\n1.  **Primary Check:** The function inverts the case of the directory path and checks if the inverted-case version resolves to an existing directory. This is fast, requires no write permissions, and doesn't trigger file watchers.\n2.  **Fallback Check:** If the primary check is inconclusive (e.g., the path has no letters to invert or the directory doesn't exist), it safely writes and immediately deletes a temporary file in that directory. When checking the default working directory and it's not writable, it falls back to the OS temp directory.\n3.  **Caching:** Results are **cached per directory**. Subsequent calls for the same directory return instantly without re-checking.\n\n> [!IMPORTANT]\n> Since different mount points can have different case-sensitivity settings, this package checks the filesystem where the specified directory resides. Always pass the directory you care about to get accurate results for that filesystem.\n\n## 🛠️ API\n\n### `isFsCaseSensitive(directoryPath?, fsInstance?, useCache?)`\n\nReturns: `boolean`\n\nReturns `true` if the filesystem is case-sensitive, `false` otherwise.\n\n#### `directoryPath`\n\nType: `string`\n\nDefault: `process.cwd()`\n\nThe directory path to check. Different mount points can have different case-sensitivity settings.\n\nWhen omitted (defaults to current working directory), the function will fall back to checking the OS temp directory if the working directory isn't writable. When explicitly provided, the function will throw an error if the directory isn't accessible or writable.\n\n#### `fsInstance`\n\nType: `object` with `existsSync`, `writeFileSync`, and `unlinkSync` methods.\n\nDefault: Node.js `fs` module.\n\nAn optional filesystem implementation to use. This is primarily intended for testing with mock filesystems like `memfs`.\n\n#### `useCache`\n\nType: `boolean`\n\nDefault: `true`\n\nControls whether the result is cached per directory.\n- `true`: The check runs once per directory, and results are cached. Subsequent calls for the same directory return instantly.\n- `false`: The cache is bypassed, and the filesystem check is re-run. This is useful for tests where you need to check different mock filesystems.\n","readmeFilename":"README.md"}