Skip to main content

buildDownloadFilename

FitFileViewer - API Documentation v29.4.0


FitFileViewer - API Documentation / utils/files/sanitizeFilename / buildDownloadFilename

Function: buildDownloadFilename()

buildDownloadFilename(candidatePath: string, options?: { defaultExtension?: string; fallbackBase?: string; }): string

Defined in: utils/files/sanitizeFilename.js:47

Builds a safe download name from an arbitrary path/label. If the source lacks an extension, defaultExtension is appended after sanitisation. The result is always safe to assign to the download attribute of an anchor element.

Parameters​

candidatePath​

string

Raw file path or label suggested by the user/app.

options?​

defaultExtension?​

string

fallbackBase?​

string

Returns​

string