Generates a safe file name by replacing special characters with underscores. Consecutive underscores are also reduced to a single underscore.
The original file name to be sanitized.
import { getSafeFileName } from "nsuite";const safeFileName = getSafeFileName("测试有空格 和特殊符号 &.pdf"); Copy
import { getSafeFileName } from "nsuite";const safeFileName = getSafeFileName("测试有空格 和特殊符号 &.pdf");
Generates a safe file name by replacing special characters with underscores. Consecutive underscores are also reduced to a single underscore.