# slash

> Convert Windows backslash paths to slash paths

Latest version **5.1.0** (published 2023-05-09) · MIT license · 0 weekly downloads

> **Better alternative:** Use path.startsWith('\\?\') ? path : path.replace(/\/g, '/') — Consider using a lighter alternative

## Install

```sh
npm install slash
pnpm add slash
yarn add slash
bun add slash
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.0 |
| Published | 2023-05-09 |
| First published | 2013-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=14.16 |
| Dependencies | 0 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 338 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | path, seperator, slash, backslash, windows, convert |

## Links

- npm: https://www.npmjs.com/package/slash
- Repository: https://github.com/sindresorhus/slash
- Homepage: https://github.com/sindresorhus/slash#readme
- Issues: https://github.com/sindresorhus/slash/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/slash

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 5.1.0 (latest) — 2023-05-09
- 5.0.1 — 2023-04-25
- 5.0.0 — 2022-09-27
- 4.0.0 — 2021-04-14
- 3.0.0 — 2019-04-28
- 2.0.0 — 2018-03-23
- 1.0.0 — 2014-08-13
- 0.1.3 — 2014-04-30
- 0.1.1 — 2013-10-08
- 0.1.0 — 2013-07-18

## README

# slash

> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`

[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths.

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

## Install

```sh
npm install slash
```

## Usage

```js
import path from 'node: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.

---
_Source: https://npm.io/package/slash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
