slash (4.0.0)

Published 2026-02-24 14:05:09 +00:00 by atheaadmin

Installation

registry=
npm install slash@4.0.0
"slash": "4.0.0"

About this package

slash

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

import path from 'path';
import slash from '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.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Dependencies

Development Dependencies

ID Version
ava ^3.15.0
tsd ^0.14.0
xo ^0.38.2

Keywords

path seperator slash backslash windows convert
Details
npm
2026-02-24 14:05:09 +00:00
1
Sindre Sorhus
MIT
latest
2.0 KiB
Assets (1)
slash-4.0.0.tgz 2.0 KiB
Versions (2) View all
4.0.0 2026-02-24
3.0.0 2026-02-24