{"_id":"wsl-utils","_rev":"4103612","name":"wsl-utils","description":"Utilities for working with Windows Subsystem for Linux (WSL)","dist-tags":{"latest":"0.3.1"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-01-11T18:47:01.000Z","created":"2025-05-23T23:47:12.897Z","0.3.1":"2026-01-02T13:12:04.090Z","0.3.0":"2025-11-15T08:15:04.989Z","0.2.0":"2025-11-11T18:37:39.917Z","0.1.0":"2025-05-23T23:47:12.897Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/wsl-utils.git"},"versions":{"0.3.1":{"name":"wsl-utils","version":"0.3.1","description":"Utilities for working with Windows Subsystem for Linux (WSL)","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/wsl-utils.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"test":"xo && ava && tsc index.d.ts --skipLibCheck"},"keywords":["wsl","windows","subsystem","linux","powershell","mount","utilities"],"dependencies":{"is-wsl":"^3.1.0","powershell-utils":"^0.1.0"},"devDependencies":{"ava":"^6.4.1","typescript":"^5.9.3","xo":"^1.2.3"},"gitHead":"5320748a16e6b149741cd0399a482f77159935c2","types":"./index.d.ts","_id":"wsl-utils@0.3.1","bugs":{"url":"https://github.com/sindresorhus/wsl-utils/issues"},"homepage":"https://github.com/sindresorhus/wsl-utils#readme","_nodeVersion":"24.12.0","_npmVersion":"11.6.1","dist":{"shasum":"9479836ddf03be267aad3abfc3cb1f6e0c9f1ed1","size":3578,"noattachment":false,"key":"/wsl-utils/-/wsl-utils-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/wsl-utils/download/wsl-utils-0.3.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wsl-utils_0.3.1_1767359523939_0.03591857818349675"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-01-02T13:12:04.090Z","publish_time":1767359524090,"_source_registry_name":"default","_cnpm_publish_time":1767359524090},"0.3.0":{"name":"wsl-utils","version":"0.3.0","description":"Utilities for working with Windows Subsystem for Linux (WSL)","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/wsl-utils.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"test":"xo && ava && tsc index.d.ts --skipLibCheck"},"keywords":["wsl","windows","subsystem","linux","powershell","mount","utilities"],"dependencies":{"is-wsl":"^3.1.0","powershell-utils":"^0.1.0"},"devDependencies":{"ava":"^6.4.1","typescript":"^5.9.3","xo":"^1.2.3"},"gitHead":"2e811dfde52fa8b44aef793a85538321df166433","types":"./index.d.ts","_id":"wsl-utils@0.3.0","bugs":{"url":"https://github.com/sindresorhus/wsl-utils/issues"},"homepage":"https://github.com/sindresorhus/wsl-utils#readme","_nodeVersion":"20.19.5","_npmVersion":"11.6.1","dist":{"shasum":"197049b93b34b822703bf4ccde8256660651205f","size":3338,"noattachment":false,"key":"/wsl-utils/-/wsl-utils-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/wsl-utils/download/wsl-utils-0.3.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wsl-utils_0.3.0_1763194504780_0.7132711681843236"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-11-15T08:15:04.989Z","publish_time":1763194504989,"_source_registry_name":"default","_cnpm_publish_time":1763194504989},"0.2.0":{"name":"wsl-utils","version":"0.2.0","description":"Utilities for working with Windows Subsystem for Linux (WSL)","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/wsl-utils.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts --skipLibCheck"},"keywords":["wsl","windows","subsystem","linux","powershell","mount","utilities"],"dependencies":{"is-wsl":"^3.1.0"},"devDependencies":{"ava":"^6.3.0","typescript":"^5.8.3","xo":"^1.0.0"},"gitHead":"7748c9b770ff0ce903b8e53097647f90af875ac6","types":"./index.d.ts","_id":"wsl-utils@0.2.0","bugs":{"url":"https://github.com/sindresorhus/wsl-utils/issues"},"homepage":"https://github.com/sindresorhus/wsl-utils#readme","_nodeVersion":"20.19.5","_npmVersion":"11.6.1","dist":{"shasum":"d2fdda12c19349a42778ec516f3eb56b4cc2c4ce","size":2730,"noattachment":false,"key":"/wsl-utils/-/wsl-utils-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/wsl-utils/download/wsl-utils-0.2.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wsl-utils_0.2.0_1762886259726_0.03410946033577522"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-11-11T18:37:39.917Z","publish_time":1762886259917,"_source_registry_name":"default","_cnpm_publish_time":1762886259917},"0.1.0":{"name":"wsl-utils","version":"0.1.0","description":"Utilities for working with Windows Subsystem for Linux (WSL)","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/wsl-utils.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts --skipLibCheck"},"keywords":["wsl","windows","subsystem","linux","powershell","mount","utilities"],"dependencies":{"is-wsl":"^3.1.0"},"devDependencies":{"ava":"^6.3.0","typescript":"^5.8.3","xo":"^1.0.0"},"_id":"wsl-utils@0.1.0","gitHead":"04a87271eb4e2383c1bcd2f20146693d40bdd4bb","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/wsl-utils/issues"},"homepage":"https://github.com/sindresorhus/wsl-utils#readme","_nodeVersion":"20.19.1","_npmVersion":"10.9.2","dist":{"shasum":"8783d4df671d4d50365be2ee4c71917a0557baab","size":2287,"noattachment":false,"key":"/wsl-utils/-/wsl-utils-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/wsl-utils/download/wsl-utils-0.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wsl-utils_0.1.0_1748044032698_0.9980935081165065"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-05-23T23:47:12.897Z","publish_time":1748044032897,"_source_registry_name":"default","_cnpm_publish_time":1748044032897}},"readme":"# wsl-utils\n\n> Utilities for working with [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)\n\n## Install\n\n```sh\nnpm install wsl-utils\n```\n\n## Usage\n\n```js\nimport {isWsl, powerShellPathFromWsl} from 'wsl-utils';\n\n// Check if running in WSL\nconsole.log('Is WSL:', isWsl);\n\n// Get PowerShell path from WSL\nconsole.log('PowerShell path:', await powerShellPathFromWsl());\n//=> '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'\n```\n\n## API\n\n### isWsl\n\nType: `boolean`\n\nCheck if the current environment is Windows Subsystem for Linux (WSL).\n\n### powerShellPathFromWsl()\n\nReturns: `Promise<string>`\n\nGet the PowerShell executable path in WSL environment.\n\n### powerShellPath()\n\nReturns: `Promise<string>`\n\nGet the PowerShell executable path for the current environment.\n\nReturns WSL path if in WSL, otherwise returns Windows path.\n\n### canAccessPowerShell()\n\nReturns: `Promise<boolean>`\n\nCheck if PowerShell is accessible in the current environment.\n\nThis is useful to determine whether Windows integration features can be used. In sandboxed WSL environments or systems where PowerShell is not accessible, this will return `false`.\n\n```js\nimport {canAccessPowerShell} from 'wsl-utils';\n\nif (await canAccessPowerShell()) {\n\t// Use Windows integration features\n\tconsole.log('PowerShell is accessible');\n} else {\n\t// Fall back to Linux-native behavior\n\tconsole.log('PowerShell is not accessible');\n}\n```\n\n### wslDefaultBrowser()\n\nReturns: `Promise<string>`\n\nGet the default browser in WSL.\n\nReturns a promise that resolves to the [ProgID](https://setuserfta.com/guide-to-understanding-progids-and-file-type-associations/) of the default browser (e.g., `'ChromeHTML'`, `'FirefoxURL'`).\n\n```js\nimport {wslDefaultBrowser} from 'wsl-utils';\n\nconst progId = await wslDefaultBrowser();\n//=> 'ChromeHTML'\n```\n\n### wslDrivesMountPoint()\n\nReturns: `Promise<string>`\n\nGet the mount point for fixed drives in WSL.\n\n### convertWslPathToWindows(path)\n\nReturns: `Promise<string>`\n\nConvert a WSL Linux path to a Windows-accessible path.\n\nURLs (strings starting with a protocol like `https://`) are returned unchanged.\n\n```js\nimport {convertWslPathToWindows} from 'wsl-utils';\n\n// Convert a Linux path\nconst windowsPath = await convertWslPathToWindows('/home/user/file.html');\n//=> '\\\\wsl.localhost\\Ubuntu\\home\\user\\file.html'\n\n// URLs are not converted\nconst url = await convertWslPathToWindows('https://example.com');\n//=> 'https://example.com'\n```\n\n#### path\n\nType: `string`\n\nThe WSL path to convert (e.g., `/home/user/file.html`).\n","_attachments":{},"homepage":"https://github.com/sindresorhus/wsl-utils#readme","bugs":{"url":"https://github.com/sindresorhus/wsl-utils/issues"},"license":"MIT"}