(finalPath: string, content: string, encoding: string)
| 491 | } |
| 492 | |
| 493 | async function writeFileWithEncoding(finalPath: string, content: string, encoding: string) { |
| 494 | // 验证路径安全性(已移除路径限制) |
| 495 | const validatedPath = validatePath(finalPath); |
| 496 | |
| 497 | await fs.mkdir(path.dirname(validatedPath), { recursive: true }); |
| 498 | await fs.writeFile(validatedPath, content, encoding); |
| 499 | } |
| 500 | |
| 501 | // Write document function |
| 502 | async function writeDocument( |
no test coverage detected