Package

purescript-node-fs-aff

Repository
purescript-node/purescript-node-fs-aff
License
MIT
Uploaded by
pacchettibotti
Published on
2023-03-24T10:15:12Z

Latest release Build status Pursuit

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.

Installation

spago install node-fs-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