AS
Size: a a a
AS
АП
AS
AS
AS
АП
AS
AS
AS
const commonPath = path.join(__dirname, '..', '.data');
const createPath = (dir, fileName) => path.join(commonPath, dir, fileName);
const rename = async (dir, oldName, newName) => {
const filePath = createPath(dir, oldName);
const newFilePath = createPath(dir, newName);
try {
const fileHandle = await fs.open(newFilePath, 'wx');
try {
await fs.rename(filePath, newFilePath);
} catch (err) {
throw new Error(err);
} finally {
await fileHandle.close();
}
} catch (err) { // if file exists
throw new Error(err);
}
};
АП
A
Q
Q
DK
JK
DH
JK
V
АМ
Q