dirDoesntExist

The resolution of the promise will happen if the directory doesn't exist. The dirPath is resolved if directory is inexistent, whereas it will throw if the dirPath passed as parameter is an existing directory.
Parameter ListReturnsRejection Errors
  • dirPath: string
  • tuple: Array (optional)
Promise<string || Array>
Related FunctionsFunction Signature
function dirDoesntExist(dirPath[, tuple]): Promise<string || Array>
1 2 3 4 import {dirDoesntExist} from 'puddy-m/lib/fileFunctions' dirDoesntExist('path/to/supposed/dir') .then(supposedDirPath=>console.log(supposedDirPath)) // prints 'path/to/supposed/dir'
1 2 3 4 import {dirDoesntExist} from 'puddy-m/lib/fileFunctions' dirDoesntExist(true) .catch(e=>e)
1 2 3 4 5 6 // Using it with tuple parameter import {dirDoesntExist} from 'puddy-m/lib/fileFunctions' dirDoesntExist('path/to/supposed/dir', []) .then(tuple=>validateString("World", tuple)) .then(([first, second])=> first + second) // 'path/to/supposed/dirWorld'