2026/4/18小於 1 分鐘
mergeFiles
將多個檔案合併成一個檔案。
語法
mergeFiles(sourcePaths: string[], targetPath: string): void參數
| 參數名稱 | 類型 | 說明 |
|---|---|---|
sourcePaths | string[] | 要合併的檔案路徑陣列 |
targetPath | string | 輸出檔案的路徑 |
// 這將把 file1.txt 和 file2.txt 的內容合併到 merged.txt 中
FilesJS.mergeFiles(['file1.txt', 'file2.txt'], 'merged.txt');