Function fileNameWithEllipsis

  • Name

    fileNameWithEllipsis

    Description

    Truncates a filename while preserving the extension

    Returns

    Truncated filename with extension

    Example

    fileNameWithEllipsis({ filename: 'very-long-filename.pdf' }, 10) // 'very-long-f….pdf'
    fileNameWithEllipsis({ name: 'short.txt' }, 10) // 'short.txt'

    Parameters

    • file: {
          filename?: string;
          name?: string;
      }

      File object containing filename or name property

      • Optional filename?: string
      • Optional name?: string
    • Optional maxLength: number = 26

      Maximum length of the filename (excluding extension)

    • Optional ellipsis: string = '…'

      Character to use for truncation

    Returns string

Generated using TypeDoc