2026/4/18小於 1 分鐘
processLargeFiles
處理大型檔案。
語法
processLargeFiles(path: string, lineProcessor: (data: string) => void): void參數
| 參數名稱 | 類型 | 說明 |
|---|---|---|
path | string | 要處理的檔案路徑 |
lineProcessor | (data: string) => void | 處理檔案行數據的回調函數 |
// 這將逐行讀取 large-file.txt,並對每一行調用回調函數來處理數據
FilesJS.processLargeFiles('large-file.txt', (line) => {
console.log(line);
});