websocket快速操作工具
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.

74 lines
2.0 KiB

  1. file-uri-to-path
  2. ================
  3. ### Convert a `file:` URI to a file path
  4. [![Build Status](https://travis-ci.org/TooTallNate/file-uri-to-path.svg?branch=master)](https://travis-ci.org/TooTallNate/file-uri-to-path)
  5. Accepts a `file:` URI and returns a regular file path suitable for use with the
  6. `fs` module functions.
  7. Installation
  8. ------------
  9. Install with `npm`:
  10. ``` bash
  11. $ npm install file-uri-to-path
  12. ```
  13. Example
  14. -------
  15. ``` js
  16. var uri2path = require('file-uri-to-path');
  17. uri2path('file://localhost/c|/WINDOWS/clock.avi');
  18. // "c:\\WINDOWS\\clock.avi"
  19. uri2path('file:///c|/WINDOWS/clock.avi');
  20. // "c:\\WINDOWS\\clock.avi"
  21. uri2path('file://localhost/c:/WINDOWS/clock.avi');
  22. // "c:\\WINDOWS\\clock.avi"
  23. uri2path('file://hostname/path/to/the%20file.txt');
  24. // "\\\\hostname\\path\\to\\the file.txt"
  25. uri2path('file:///c:/path/to/the%20file.txt');
  26. // "c:\\path\\to\\the file.txt"
  27. ```
  28. API
  29. ---
  30. ### fileUriToPath(String uri) → String
  31. License
  32. -------
  33. (The MIT License)
  34. Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
  35. Permission is hereby granted, free of charge, to any person obtaining
  36. a copy of this software and associated documentation files (the
  37. 'Software'), to deal in the Software without restriction, including
  38. without limitation the rights to use, copy, modify, merge, publish,
  39. distribute, sublicense, and/or sell copies of the Software, and to
  40. permit persons to whom the Software is furnished to do so, subject to
  41. the following conditions:
  42. The above copyright notice and this permission notice shall be
  43. included in all copies or substantial portions of the Software.
  44. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  45. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  46. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  47. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  48. CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  49. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  50. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.