Skip to content

Commit b226943

Browse files
committed
feat: aff -> forgot some functions
1 parent 4216697 commit b226943

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

src/Node/FS/Aff.purs

+28-8
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ module Node.FS.Aff
3333
, readdirDirentBuffer'
3434
, utimes
3535
, readFile
36+
, readFile'
3637
, readTextFile
38+
, readTextFile'
3739
, writeFile
40+
, writeFile'
3841
, writeTextFile
42+
, writeTextFile'
3943
, appendFile
44+
, appendFile'
4045
, appendTextFile
4146
, fdOpen
4247
, fdRead
@@ -85,7 +90,7 @@ import Node.Buffer (Buffer)
8590
import Node.Encoding (Encoding)
8691
import Node.FS.Types (BufferLength, BufferOffset, ByteCount, FileDescriptor, FileMode, FilePosition, SymlinkType)
8792
import Node.FS.Internal.AffUtils (toAff1, toAff2, toAff3, toAff4, toAff5)
88-
import Node.FS.Options (CpOptions, FdReadOptions, FdWriteOptions, OpendirOptions, RealpathOptions, RmOptions, RmdirOptions)
93+
import Node.FS.Options (AppendFileBufferOptions, CpOptions, FdReadOptions, FdWriteOptions, GlobDirentOptions, GlobFilePathOptions, MkdirOptions, OpendirOptions, ReadFileBufferOptions, ReadFileStringOptions, ReaddirBufferOptions, ReaddirDirentBufferOptions, ReaddirDirentOptions, ReaddirFilePathOptions, RealpathOptions, RmOptions, RmdirOptions, WriteFileBufferOptions, WriteFileStringOptions)
8994
import Node.FS.Constants (AccessMode, CopyMode, FileFlags)
9095
import Node.FS.Async as A
9196
import Node.FS.Dir (Dir)
@@ -226,7 +231,7 @@ mkdir = toAff1 A.mkdir
226231
-- |
227232
-- | Makes a new directory with all of its options.
228233
-- |
229-
mkdir' :: FilePath -> { recursive :: Boolean, mode :: Perms } -> Aff Unit
234+
mkdir' :: FilePath -> MkdirOptions -> Aff Unit
230235
mkdir' = toAff2 A.mkdir'
231236

232237
-- |
@@ -236,23 +241,23 @@ readdir :: FilePath -> Aff (Array FilePath)
236241
readdir = toAff1 A.readdir
237242

238243
-- | Reads the contents of a directory with options.
239-
readdir' :: FilePath -> { recursive :: Boolean, encoding :: Encoding } -> Aff (Array FilePath)
244+
readdir' :: FilePath -> ReaddirFilePathOptions -> Aff (Array FilePath)
240245
readdir' = toAff2 A.readdir'
241246

242247
-- | Reads the contents of a directory and returns an Aff (Array Buffer).
243248
readdirBuffer :: FilePath -> Aff (Array Buffer)
244249
readdirBuffer = toAff1 A.readdirBuffer
245250

246251
-- | Reads the contents of a directory with options and returns Aff (Array Buffer).
247-
readdirBuffer' :: FilePath -> { recursive :: Boolean } -> Aff (Array Buffer)
252+
readdirBuffer' :: FilePath -> ReaddirBufferOptions -> Aff (Array Buffer)
248253
readdirBuffer' = toAff2 A.readdirBuffer'
249254

250255
-- | Reads the contents of a directory and returns an Aff (Array (Dirent DirentNameTypeString)).
251256
readdirDirent :: FilePath -> Aff (Array (Dirent DirentNameTypeString))
252257
readdirDirent = toAff1 A.readdirDirent
253258

254259
-- | Reads the contents of a directory with options and returns Aff (Array (Dirent DirentNameTypeString)).
255-
readdirDirent' :: FilePath -> { recursive :: Boolean, encoding :: Encoding } -> Aff (Array (Dirent DirentNameTypeString))
260+
readdirDirent' :: FilePath -> ReaddirDirentOptions -> Aff (Array (Dirent DirentNameTypeString))
256261
readdirDirent' = toAff2 A.readdirDirent'
257262

258263
-- | Reads the contents of a directory.
@@ -264,7 +269,7 @@ readdirDirentBuffer = toAff1 A.readdirDirentBuffer
264269
-- | Reads the contents of a directory.
265270
readdirDirentBuffer'
266271
:: FilePath
267-
-> { recursive :: Boolean }
272+
-> ReaddirDirentBufferOptions
268273
-> Aff (Array (Dirent DirentNameTypeBuffer))
269274
readdirDirentBuffer' = toAff2 A.readdirDirentBuffer'
270275

@@ -280,30 +285,45 @@ utimes = toAff3 A.utimes
280285
readFile :: FilePath -> Aff Buffer
281286
readFile = toAff1 A.readFile
282287

288+
readFile' :: FilePath -> ReadFileBufferOptions -> Aff Buffer
289+
readFile' = toAff2 A.readFile'
290+
283291
-- |
284292
-- | Reads the entire contents of a text file with the specified encoding.
285293
-- |
286294
readTextFile :: Encoding -> FilePath -> Aff String
287295
readTextFile = toAff2 A.readTextFile
288296

297+
readTextFile' :: FilePath -> ReadFileStringOptions -> Aff String
298+
readTextFile' = toAff2 A.readTextFile'
299+
289300
-- |
290301
-- | Writes a buffer to a file.
291302
-- |
292303
writeFile :: FilePath -> Buffer -> Aff Unit
293304
writeFile = toAff2 A.writeFile
294305

306+
writeFile' :: FilePath -> Buffer -> WriteFileBufferOptions -> Aff Unit
307+
writeFile' = toAff3 A.writeFile'
308+
295309
-- |
296310
-- | Writes text to a file using the specified encoding.
297311
-- |
298312
writeTextFile :: Encoding -> FilePath -> String -> Aff Unit
299313
writeTextFile = toAff3 A.writeTextFile
300314

315+
writeTextFile' :: FilePath -> String -> WriteFileStringOptions -> Aff Unit
316+
writeTextFile' = toAff3 A.writeTextFile'
317+
301318
-- |
302319
-- | Appends the contents of a buffer to a file.
303320
-- |
304321
appendFile :: FilePath -> Buffer -> Aff Unit
305322
appendFile = toAff2 A.appendFile
306323

324+
appendFile' :: FilePath -> Buffer -> AppendFileBufferOptions -> Aff Unit
325+
appendFile' = toAff3 A.appendFile'
326+
307327
-- |
308328
-- | Appends text to a file using the specified encoding.
309329
-- |
@@ -429,13 +449,13 @@ futimes = toAff3 A.futimes
429449
glob :: Array FilePath -> Aff (Array FilePath)
430450
glob = toAff1 A.glob
431451

432-
glob' :: Array FilePath -> { cwd :: Maybe FilePath, exclude :: Maybe (FilePath -> Boolean) } -> Aff (Array FilePath)
452+
glob' :: Array FilePath -> GlobFilePathOptions -> Aff (Array FilePath)
433453
glob' = toAff2 A.glob'
434454

435455
globDirent :: Array FilePath -> Aff (Array (Dirent DirentNameTypeString))
436456
globDirent = toAff1 A.globDirent
437457

438-
globDirent' :: Array FilePath -> { cwd :: Maybe FilePath, exclude :: Maybe (Dirent DirentNameTypeString -> Boolean) } -> Aff (Array (Dirent DirentNameTypeString))
458+
globDirent' :: Array FilePath -> GlobDirentOptions -> Aff (Array (Dirent DirentNameTypeString))
439459
globDirent' = toAff2 A.globDirent'
440460

441461
-- | Change permissions on a symbolic link. See the [Node Documentation](https://nodejs.org/api/fs.html#fs_fs_lchmod_path_mode_callback)

0 commit comments

Comments
 (0)