File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 123123
124124 chown :: forall eff. FilePath -> Number -> Number -> Eff (err :: Exception, fs :: FS | eff) Unit
125125
126+ exists :: forall eff. FilePath -> Eff (fs :: FS | eff) Boolean
127+
126128 link :: forall eff. FilePath -> FilePath -> Eff (err :: Exception, fs :: FS | eff) Unit
127129
128130 mkdir :: forall eff. FilePath -> Eff (err :: Exception, fs :: FS | eff) Unit
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module Node.FS.Sync
2121 , writeTextFile
2222 , appendFile
2323 , appendTextFile
24+ , exists
2425 ) where
2526
2627import Control.Monad.Eff
@@ -52,6 +53,7 @@ foreign import fs "var fs = require('fs');" ::
5253 , readFileSync :: forall a opts . Fn2 FilePath { | opts } a
5354 , writeFileSync :: forall a opts . Fn3 FilePath a { | opts } Unit
5455 , appendFileSync :: forall a opts . Fn3 FilePath a { | opts } Unit
56+ , existsSync :: Fn1 FilePath Boolean
5557 }
5658
5759foreign import mkEff
@@ -278,3 +280,11 @@ appendTextFile :: forall eff. Encoding
278280
279281appendTextFile encoding file buff = mkEff $ \_ -> runFn3
280282 fs.appendFileSync file buff { encoding: show encoding }
283+
284+ -- |
285+ -- Check if the path exists.
286+ --
287+ exists :: forall eff . FilePath
288+ -> Eff (fs :: FS | eff ) Boolean
289+ exists file = mkEff $ \_ -> runFn1
290+ fs.existsSync file
You can’t perform that action at this time.
0 commit comments