File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 4242
4343 readTextFile :: forall eff. Encoding -> FilePath -> Callback eff String -> Eff (fs :: FS | eff) Unit
4444
45+ readdir :: forall eff. FilePath -> Callback eff [FilePath] -> Eff (fs :: FS | eff) Unit
46+
4547 readlink :: forall eff. FilePath -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit
4648
4749 realpath :: forall eff. FilePath -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit
121123
122124 readTextFile :: forall eff. Encoding -> FilePath -> Eff (err :: Exception Error, fs :: FS | eff) String
123125
126+ readdir :: forall eff. FilePath -> Eff (err :: Exception Error, fs :: FS | eff) [FilePath]
127+
124128 readlink :: forall eff. FilePath -> Eff (err :: Exception Error, fs :: FS | eff) FilePath
125129
126130 realpath :: forall eff. FilePath -> Eff (err :: Exception Error, fs :: FS | eff) FilePath
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ module Node.FS.Async
1414 , rmdir
1515 , mkdir
1616 , mkdir'
17+ , readdir
1718 , readFile
1819 , readTextFile
1920 , writeFile
@@ -58,6 +59,7 @@ foreign import fs "var fs = require('fs');" ::
5859 , unlink :: Fn2 FilePath (JSCallback Unit ) Unit
5960 , rmdir :: Fn2 FilePath (JSCallback Unit ) Unit
6061 , mkdir :: Fn3 FilePath Number (JSCallback Unit ) Unit
62+ , readdir :: Fn2 FilePath (JSCallback [FilePath ]) Unit
6163 , readFile :: forall a opts . Fn3 FilePath { | opts } (JSCallback a ) Unit
6264 , writeFile :: forall a opts . Fn4 FilePath a { | opts } (JSCallback Unit ) Unit
6365 }
@@ -217,6 +219,16 @@ mkdir' :: forall eff. FilePath
217219mkdir' file mode cb = return $ runFn3
218220 fs.mkdir file mode (handleCallback cb)
219221
222+ -- |
223+ -- Reads the contents of a directory.
224+ --
225+ readdir :: forall eff . FilePath
226+ -> Callback eff [FilePath ]
227+ -> Eff (fs :: FS | eff ) Unit
228+
229+ readdir file cb = return $ runFn2
230+ fs.readdir file (handleCallback cb)
231+
220232-- |
221233-- Reads the entire contents of a file returning the result as a raw buffer.
222234--
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module Node.FS.Sync
1313 , rmdir
1414 , mkdir
1515 , mkdir'
16+ , readdir
1617 , readFile
1718 , readTextFile
1819 , writeFile
@@ -42,6 +43,7 @@ foreign import fs "var fs = require('fs');" ::
4243 , unlinkSync :: Fn1 FilePath Unit
4344 , rmdirSync :: Fn1 FilePath Unit
4445 , mkdirSync :: Fn2 FilePath Number Unit
46+ , readdirSync :: Fn1 FilePath [FilePath ]
4547 , readFileSync :: forall a opts . Fn2 FilePath { | opts } a
4648 , writeFileSync :: forall a opts . Fn3 FilePath a { | opts } Unit
4749 }
@@ -187,6 +189,15 @@ mkdir' :: forall eff. FilePath
187189mkdir' file mode = mkEff $ \_ -> runFn2
188190 fs.mkdirSync file mode
189191
192+ -- |
193+ -- Reads the contents of a directory.
194+ --
195+ readdir :: forall eff . FilePath
196+ -> Eff (fs :: FS , err :: Exception Error | eff ) [FilePath ]
197+
198+ readdir file = mkEff $ \_ -> runFn1
199+ fs.readdirSync file
200+
190201-- |
191202-- Reads the entire contents of a file returning the result as a raw buffer.
192203--
You can’t perform that action at this time.
0 commit comments