slash
    Overview
    Documentation
    Insights
    Code
    Contributors
    Dependencies
    Alternatives

slash

Convert Windows backslash paths to slash paths

3.0.0  •  Updated 9 months ago  •  by Sindre Sorhus  •  MIT License

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

How often do you use dark themes on other websites?

Popularity

Weekly Downloads
14.3M
Stars
132

Maintenance

Development

Last ver 9 months ago
Created 7 years ago
Last commit 8 months ago
3 months between commits

Technology

Node version: 10.15.3
3.5K unpacked

Compliance

MIT License
OSI Approved
0 vulnerabilities

Contributors

4 contributors
Sindre Sorhus
Maintainer, 20 commits, 3 merges
Kevin Mårtensson
Maintainer, 1 commits, 1 PRs
Works at imagemin yeoman
Paul Miller
1 commits, 1 PRs
Works at hy-dev
Dimitri Benin
1 commits, 1 PRs
Arthur Verschaeve
Maintainer
Vsevolod Strukchinsky
Maintainer
Works at Yandex

Tags

path
seperator
slash
backslash
windows
convert
Ready for the next level?
Join Openbase's founding team to help us build the ultimate open-source app store, work with the latest technologies, and enjoy great culture, impact and autonomy
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
© 2020 Devstore, Inc.