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 42
42
43
43
readTextFile :: forall eff. Encoding -> FilePath -> Callback eff String -> Eff (fs :: FS | eff) Unit
44
44
45
+ readdir :: forall eff. FilePath -> Callback eff [FilePath] -> Eff (fs :: FS | eff) Unit
46
+
45
47
readlink :: forall eff. FilePath -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit
46
48
47
49
realpath :: forall eff. FilePath -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit
121
123
122
124
readTextFile :: forall eff. Encoding -> FilePath -> Eff (err :: Exception Error, fs :: FS | eff) String
123
125
126
+ readdir :: forall eff. FilePath -> Eff (err :: Exception Error, fs :: FS | eff) [FilePath]
127
+
124
128
readlink :: forall eff. FilePath -> Eff (err :: Exception Error, fs :: FS | eff) FilePath
125
129
126
130
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
14
14
, rmdir
15
15
, mkdir
16
16
, mkdir'
17
+ , readdir
17
18
, readFile
18
19
, readTextFile
19
20
, writeFile
@@ -58,6 +59,7 @@ foreign import fs "var fs = require('fs');" ::
58
59
, unlink :: Fn2 FilePath (JSCallback Unit ) Unit
59
60
, rmdir :: Fn2 FilePath (JSCallback Unit ) Unit
60
61
, mkdir :: Fn3 FilePath Number (JSCallback Unit ) Unit
62
+ , readdir :: Fn2 FilePath (JSCallback [FilePath ]) Unit
61
63
, readFile :: forall a opts . Fn3 FilePath { | opts } (JSCallback a ) Unit
62
64
, writeFile :: forall a opts . Fn4 FilePath a { | opts } (JSCallback Unit ) Unit
63
65
}
@@ -217,6 +219,16 @@ mkdir' :: forall eff. FilePath
217
219
mkdir' file mode cb = return $ runFn3
218
220
fs.mkdir file mode (handleCallback cb)
219
221
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
+
220
232
-- |
221
233
-- Reads the entire contents of a file returning the result as a raw buffer.
222
234
--
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module Node.FS.Sync
13
13
, rmdir
14
14
, mkdir
15
15
, mkdir'
16
+ , readdir
16
17
, readFile
17
18
, readTextFile
18
19
, writeFile
@@ -42,6 +43,7 @@ foreign import fs "var fs = require('fs');" ::
42
43
, unlinkSync :: Fn1 FilePath Unit
43
44
, rmdirSync :: Fn1 FilePath Unit
44
45
, mkdirSync :: Fn2 FilePath Number Unit
46
+ , readdirSync :: Fn1 FilePath [FilePath ]
45
47
, readFileSync :: forall a opts . Fn2 FilePath { | opts } a
46
48
, writeFileSync :: forall a opts . Fn3 FilePath a { | opts } Unit
47
49
}
@@ -187,6 +189,15 @@ mkdir' :: forall eff. FilePath
187
189
mkdir' file mode = mkEff $ \_ -> runFn2
188
190
fs.mkdirSync file mode
189
191
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
+
190
201
-- |
191
202
-- Reads the entire contents of a file returning the result as a raw buffer.
192
203
--
You can’t perform that action at this time.
0 commit comments