Skip to main content

filterWin32Path() function

Replaces non-alphanumeric characters with dashes to make paths comply with Windows file system names.

Signature

export declare function filterWin32Path(input: string): string;

Parameters

Parameter

Type

Description

input

string

A path candidate.

Returns

string

A validated path.

Remarks

This function provides explicit Windows path sanitization regardless of the current platform. Useful when generating paths that will be used on Windows systems, or when consistency across platforms is required.

Processing rules:

  • Preserves backslashes (\\) for path separators.
  • Preserves colons (:) for drive letter designation (e.g., C:).
  • Replaces all other non-alphanumeric characters with dashes.
  • Collapses consecutive dashes to single dashes.

Use this function instead of filterPath() when you need guaranteed Windows-style sanitization even when running on POSIX systems, such as when generating paths for remote Windows systems or WSL environments.


Generated via tsdoc2docusaurus 1.3.0-pre by API Extractor/Documenter 7.55.2.