Skip to content

slash

Convert all backslashes (\) in a path to forward slashes (/). If the path starts with \\?\, indicating an extended-length path, it is returned as-is without modification.

Usage

ts
import { slash } from 'rattail'

slash('C:\\path\\to\\file')
// return 'C:/path/to/file'
slash('\\\\?\\C:\\path\\to\\file')
// return '\\\\?\\C:\\path\\to\\file' (unmodified)

Arguments

ArgTypeDefaults
pathstring

Return

Type
string