fileDoesntExist
Description
It resolves the supposedFileLocation parameter if the file indeed does not exist. If file exists, it will reject an ExistingFileError.
Parameter List | Returns | Rejection Errors |
---|---|---|
| Promise<string || Array> | |
Related Functions | Function Signature | |
function fileDoesntExist(supposedFileLocation[, tuple]): Promise<string || Array> |
Examples
1
2
3
4
import {fileDoesntExist} from 'puddy-m/lib/fileFunctions'
fileDoesntExist('path/to/supposed/file')
.then(supposedfilePath=>console.log(supposedfilePath)) // prints 'path/to/supposed/file'
1
2
3
4
import {fileDoesntExist} from 'puddy-m/lib/fileFunctions'
fileDoesntExist(true)
.catch(e=>e)
1
2
3
4
5
6
// Using it with tuple parameter
import {fileDoesntExist} from 'puddy-m/lib/fileFunctions'
fileDoesntExist('path/to/supposed/file', [])
.then(tuple=>validateString("World", tuple))
.then(([first, second])=> first + second) // 'path/to/supposed/fileWorld'