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

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.

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

Install

npm install slash

Usage

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.

Current Tags

  • 5.1.0                                ...           latest (2 years ago)

10 Versions

  • 5.1.0                                ...           2 years ago
  • 5.0.1                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.0                                ...           10 years ago
  • 0.1.3                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago

Copyright 2013 - present © cnpmjs.org | Home |