nsuite - v1.0.1
    Preparing search index...

    Function getSafeFileName

    • Generates a safe file name by replacing special characters with underscores. Consecutive underscores are also reduced to a single underscore.

      Parameters

      • fileName: string

        The original file name to be sanitized.

      Returns string

      • The sanitized file name with special characters replaced by underscores and consecutive underscores reduced to a single underscore.
      import { getSafeFileName } from "nsuite";
      const safeFileName = getSafeFileName("测试有空格 和特殊符号 &.pdf");