Skip to main content

Function: to7zaOutputSwitch()

to7zaOutputSwitch(p): string

Validates a path and returns the complete 7-Zip -o<dir> switch token.

Input is first normalized via sanitizeDirPath (absolute resolution + null/newline rejection), then validated for 7za switch-token safety.

Allowlist rejects:

  • empty string (7za would receive bare -o, which fails)
  • leading - (7za would misparse the token as a new switch)
  • control chars 0x00–0x1F and DEL 0x7F (C-level truncation/control risk)

Parameters

p

string

Returns

string