@@ -13,6 +13,7 @@ module Node.FS.Async
13
13
, unlink
14
14
, rmdir
15
15
, mkdir
16
+ , mkdirRecursive
16
17
, mkdir'
17
18
, readdir
18
19
, utimes
75
76
, realpath :: forall cache . Fn3 FilePath { | cache } (JSCallback FilePath ) Unit
76
77
, unlink :: Fn2 FilePath (JSCallback Unit ) Unit
77
78
, rmdir :: Fn2 FilePath (JSCallback Unit ) Unit
78
- , mkdir :: Fn3 FilePath String (JSCallback Unit ) Unit
79
+ , mkdir :: Fn3 FilePath { recursive :: Boolean , mode :: String } (JSCallback Unit ) Unit
79
80
, readdir :: Fn2 FilePath (JSCallback (Array FilePath )) Unit
80
81
, utimes :: Fn4 FilePath Int Int (JSCallback Unit ) Unit
81
82
, readFile :: forall a opts . Fn3 FilePath { | opts } (JSCallback a ) Unit
@@ -202,16 +203,33 @@ mkdir :: FilePath
202
203
-> Callback Unit
203
204
-> Effect Unit
204
205
205
- mkdir = flip mkdir' $ mkPerms all all all
206
+ mkdir path = mkdir' path (mkPerms all all all)
207
+
208
+ -- | Makes a new directory and any directories that don't exist
209
+ -- | in the path. Similar to `mkdir -p`.
210
+ mkdirRecursive :: FilePath
211
+ -> Callback Unit
212
+ -> Effect Unit
213
+
214
+ mkdirRecursive path = mkdirRecursive' path (mkPerms all all all)
215
+
216
+ -- | Makes a new directory (and any directories that don't exist
217
+ -- | in the path) with the specified permissions.
218
+ mkdirRecursive'
219
+ :: FilePath
220
+ -> Perms
221
+ -> Callback Unit
222
+ -> Effect Unit
223
+ mkdirRecursive' file perms cb = mkEffect $ \_ -> runFn3
224
+ fs.mkdir file { recursive: true , mode: permsToString perms } (handleCallback cb)
206
225
207
226
-- | Makes a new directory with the specified permissions.
208
227
mkdir' :: FilePath
209
228
-> Perms
210
229
-> Callback Unit
211
230
-> Effect Unit
212
-
213
231
mkdir' file perms cb = mkEffect $ \_ -> runFn3
214
- fs.mkdir file ( permsToString perms) (handleCallback cb)
232
+ fs.mkdir file { recursive: false , mode: permsToString perms } (handleCallback cb)
215
233
216
234
-- | Reads the contents of a directory.
217
235
readdir :: FilePath
0 commit comments