fb660ad56a94e64b2fa4c6a2f6adccbe276bb4093c9edbcc80fd2ddc5acf973bfabe66790bd12cae9d2a5fd169a827760cdd01af871f09ff5368554b39787a 888 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/slash)
  2. > Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`
  3. [Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
  4. This was created since the `path` methods in Node outputs `\\` paths on Windows.
  5. ## Install
  6. ```
  7. $ npm install slash
  8. ```
  9. ## Usage
  10. ```js
  11. const path = require('path');
  12. const slash = require('slash');
  13. const str = path.join('foo', 'bar');
  14. // Unix => foo/bar
  15. // Windows => foo\\bar
  16. slash(str);
  17. // Unix => foo/bar
  18. // Windows => foo/bar
  19. ```
  20. ## API
  21. ### slash(path)
  22. Type: `string`
  23. Accepts a Windows backslash path and returns a slash path.
  24. ## License
  25. MIT © [Sindre Sorhus](https://sindresorhus.com)