提交学习笔记专用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
982 B

  1. # wsl-utils
  2. > Utilities for working with [Windows Subsystem for Linux (WSL)](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)
  3. ## Install
  4. ```sh
  5. npm install wsl-utils
  6. ```
  7. ## Usage
  8. ```js
  9. import {isWsl, powerShellPathFromWsl} from 'wsl-utils';
  10. // Check if running in WSL
  11. console.log('Is WSL:', isWsl);
  12. // Get PowerShell path from WSL
  13. console.log('PowerShell path:', await powerShellPathFromWsl());
  14. //=> '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
  15. ```
  16. ## API
  17. ### isWsl
  18. Type: `boolean`
  19. Check if the current environment is Windows Subsystem for Linux (WSL).
  20. ### powerShellPathFromWsl()
  21. Returns: `Promise<string>`
  22. Get the PowerShell executable path in WSL environment.
  23. ### powerShellPath()
  24. Returns: `Promise<string>`
  25. Get the PowerShell executable path for the current environment.
  26. Returns WSL path if in WSL, otherwise returns Windows path.
  27. ### wslDrivesMountPoint()
  28. Returns: `Promise<string>`
  29. Get the mount point for fixed drives in WSL.