Refactors file stat to use async API
Updates file stat operation to use the asynchronous API to prevent blocking the event loop during file system operations. This improves the responsiveness of the application, especially when dealing with potentially slow or numerous file system accesses.
This commit is contained in:
1 file changed
+1
-1
@@ -308,7 +308,7 @@ export class PandocTypstConverter {
|
||||
|
||||
let stat;
|
||||
try {
|
||||
stat = fs.statSync(itemPath);
|
||||
stat = await fsPromises.stat(itemPath);
|
||||
} catch (error) {
|
||||
// File might have been deleted between readdirSync and statSync
|
||||
console.warn(`Export: Unable to stat ${itemPath}:`, error.message);
|
||||
|
||||
Reference in new issue
Block a user