Skip to content

encodeSegment

function encodeSegment(segment): string;

Defined in: src/storage/file.ts:81

Encode one key segment as a file name that survives case-insensitive and normalization-insensitive filesystems and never escapes its directory: uppercase letters become ^ + the lowercase letter, ^ becomes ^^, bytes outside [a-z0-9._~!@,=+-] become %XX (of the UTF-8 encoding, so é never folds with e), a leading . is %2E (no ., .. or dotfiles) and the empty segment is a lone %.

Parameter Type
segment string

string