Remove unnecessary check
e.g. macOS node shell > await fs.rename("/tmp/foo/bar/quxx.txt", "/tmp/foo/a.txt") [Error: ENOENT: no such file or directory, rename '/tmp/foo/bar/quxx.txt' -> '/tmp/foo/a.txt']
This commit is contained in:
parent
eb64a00ed2
commit
f5a4830a5a
|
@ -92,9 +92,6 @@ export const readTextFile = async (filePath: string) =>
|
||||||
fs.readFile(filePath, "utf-8");
|
fs.readFile(filePath, "utf-8");
|
||||||
|
|
||||||
export const moveFile = async (sourcePath: string, destinationPath: string) => {
|
export const moveFile = async (sourcePath: string, destinationPath: string) => {
|
||||||
if (!existsSync(sourcePath)) {
|
|
||||||
throw new Error("File does not exist");
|
|
||||||
}
|
|
||||||
if (existsSync(destinationPath)) {
|
if (existsSync(destinationPath)) {
|
||||||
throw new Error("Destination file already exists");
|
throw new Error("Destination file already exists");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue