slash
Convert Windows backslash paths to slash paths
Last updated 10 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install slash 
SYNC missed versions from official npm registry.

slash Build Status

Convert Windows backslash paths to slash paths: foo\\barfoo/bar

Forward-slash paths can be used in Windows as long as they're not extended-length paths and don't contain any non-ascii characters.

This was created since the path methods in Node.js outputs \\ paths on Windows.

Install

$ npm install slash

Usage

const path = require('path');
const slash = require('slash');

const string = path.join('foo', 'bar');
// Unix    => foo/bar
// Windows => foo\\bar

slash(string);
// Unix    => foo/bar
// Windows => foo/bar

API

slash(path)

Type: string

Accepts a Windows backslash path and returns a path with forward slashes.

License

MIT © Sindre Sorhus

Current Tags

  • 3.0.0                                ...           latest (10 months ago)

6 Versions

  • 3.0.0                                ...           10 months ago
  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 43,913
This Week 87,926
This Month 794,022
Last Day 44,013
Last Week 244,666
Last Month 759,015
Dependencies (0)
None
Dev Dependencies (3)
Dependents (984)

Copyright 2014 - 2017 © taobao.org |