sanitizeFilenameComponent
FitFileViewer - API Documentation v29.4.0
FitFileViewer - API Documentation / utils/files/sanitizeFilename / sanitizeFilenameComponent
Function: sanitizeFilenameComponent()
sanitizeFilenameComponent(
value:string,fallback?:string):string
Defined in: utils/files/sanitizeFilename.js:106
Safely transforms an arbitrary string into a file-system friendly segment. Reserved Windows characters, ASCII control codes (0x00-0x1F), trailing dots and leading periods are stripped. Whitespace collapses to single underscores.
Parametersβ
valueβ
string
Original label that needs to become file-name safe.
fallback?β
string = DEFAULT_FALLBACK_BASE
Replacement when the input sanitises to nothing.
Returnsβ
string
Sanitised file name component without an extension.