isdir-async
A no-deps async version of isDirectory, to use with or without await.
At its core, it just util.promisify
ies a function that uses stat
and some callbacks to operate. Promisify the whole gives the ability to use the async
and await
keywords of Node >7.6.0
usage
// import * as isDirectory from 'isdir-async'var isDirectory = ; /** * SYNC method */if await // ...else {}
/** * ASYNC method */;
Handle the errors
/** * SYNC method */let isdir;try isdir = await ; catch err {} if isdir // ...else {}
/** * ASYNC method */