修复写入文件 mode

This commit is contained in:
whyour
2025-01-22 01:17:13 +08:00
parent 4fa5fa2014
commit 07f43538df
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -1,7 +1,7 @@
import { lock } from 'proper-lockfile';
import os from 'os';
import path from 'path';
import { writeFile, open } from 'fs/promises';
import { writeFile, open, chmod } from 'fs/promises';
import { fileExist } from '../config/util';
function getUniqueLockPath(filePath: string) {
@@ -35,5 +35,8 @@ export async function writeFileWithLock(
lockfilePath,
});
await writeFile(filePath, content, { encoding: 'utf8', ...options });
if (options?.mode) {
await chmod(filePath, options.mode);
}
await release();
}