Check If The File Or Directory Exists, And Return Stats.
npm install @wrote/exists
@wrote/exists Checks If The File Or Directory Exists, And Return Stats.
``sh`
yarn add -E @wrote/exists
- Table Of Contents
- API
- async exists(path: string): boolean
- Copyright
The package is available by importing its default function:
`js`
import exists from '@wrote/exists'
path: string,
): booleanReturns whether the path exists or not. If it exists, returns the lstat result, otherwise returns null.
`js
/ yarn example/ /
import exists from '@wrote/exists'
(async () => {
const res = await exists('example')
const isDir = res.isDirectory()
console.log(
'example exists: %s, is dir: %s', !!res, isDir,
)
const res2 = await exists('hello')
console.log('hello exists: %s', res2)
})()
````
example exists: true, is dir: true
hello exists: null
![]() | © Art Deco for Wrote 2019 | alt="Tech Nation Visa" /> | Tech Nation Visa Sucks |
|---|