Aff monad lets you write async code with ease, and
lets you easily access the filesystem within
Consider asynchronously listing only non-hidden directories:
main = launchAff do files <- FS.readdir "." files' <- flip filterM files \file -> do stat <- FS.stat file pure $ FS.isDirectory stat && (maybe false (fromChar >>> (/= ".")) $ charAt 0 file) liftEff $ print files'
That was easy. Run
npm run example to see it work.
Module documentation is published on Pursuit.