Package

purescript-node-fs-aff

Repository
purescript-node/purescript-node-fs-aff
License
MIT
Uploaded by
justinwoo
Published on
2018-05-29T23:11:12Z

Latest release Build Status

Node.FS Wrappers for purescript-aff

The Aff monad lets you write async code with ease, and node-fs-aff lets you easily access the filesystem within Aff.

Example

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.

Documentation

Module documentation is published on Pursuit.

Modules
Node.FS.Aff
Dependencies