isDirectory
Description
It verifies if the path passed is a path to a existing directory in the file system. If valid, it resolves the dirPath.
Parameter List | Returns | Rejection Errors |
---|---|---|
| Promise<string || Array> | |
Related Functions | Function Signature | |
function isDirectory(dirPath[, tuple]): Promise<string || Array> |
Examples
1
2
3
import { isDirectory } from "puddy-m/lib/fileFunctions";
isDirectory("foo/bar").then((dirPath) => console.log(dirPath)); // if foo bar exists, it will print dirPath
1
2
3
4
5
import { isDirectory } from "puddy-m/lib/fileFunctions";
isDirectory("foo/bar", [])
.then((tuple) => isDirectory("fizz/buzz", tuple))
.then(([dirPath1, dirPath2]) => console.log(dirPath1 + " - " + dirPath2)); // if foo/bar and fizz/buz exists, it will print "foo/bar - fizz/buzz"