create project
This commit is contained in:
23
kitabcitab/node_modules/next/dist/esm/lib/file-exists.js
generated
vendored
Normal file
23
kitabcitab/node_modules/next/dist/esm/lib/file-exists.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { constants, promises } from "fs";
|
||||
import isError from "./is-error";
|
||||
export async function fileExists(fileName, type) {
|
||||
try {
|
||||
if (type === "file") {
|
||||
const stats = await promises.stat(fileName);
|
||||
return stats.isFile();
|
||||
} else if (type === "directory") {
|
||||
const stats = await promises.stat(fileName);
|
||||
return stats.isDirectory();
|
||||
} else {
|
||||
await promises.access(fileName, constants.F_OK);
|
||||
}
|
||||
return true;
|
||||
} catch (err) {
|
||||
if (isError(err) && (err.code === "ENOENT" || err.code === "ENAMETOOLONG")) {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=file-exists.js.map
|
||||
Reference in New Issue
Block a user