@@ -39,180 +39,180 @@ import qualified Node.FS.Async as A
3939toAff :: forall eff a .
4040 (A.Callback eff a -> Eff (fs :: F.FS | eff ) Unit ) ->
4141 Aff (fs :: F.FS | eff ) a
42- toAff p = makeAff ( \e a -> p $ either e a)
42+ toAff p = makeAff \e a -> p $ either e a
4343
4444toAff1 f a = toAff (f a)
4545toAff2 f a b = toAff (f a b)
4646toAff3 f a b c = toAff (f a b c)
4747
4848-- |
49- -- Renames a file.
50- --
49+ -- | Rename a file.
50+ -- |
5151rename :: forall eff . FilePath
5252 -> FilePath
5353 -> Aff (fs :: F.FS | eff ) Unit
5454rename = toAff2 A .rename
5555
5656-- |
57- -- Truncates a file to the specified length.
58- --
57+ -- | Truncates a file to the specified length.
58+ -- |
5959truncate :: forall eff . FilePath
6060 -> Number
6161 -> Aff (fs :: F.FS | eff ) Unit
6262truncate = toAff2 A .truncate
6363
6464-- |
65- -- Changes the ownership of a file.
66- --
65+ -- | Changes the ownership of a file.
66+ -- |
6767chown :: forall eff . FilePath
6868 -> Number
6969 -> Number
7070 -> Aff (fs :: F.FS | eff ) Unit
7171chown = toAff3 A .chown
7272
7373-- |
74- -- Changes the permissions of a file.
75- --
74+ -- | Changes the permissions of a file.
75+ -- |
7676chmod :: forall eff . FilePath
7777 -> Perms
7878 -> Aff (fs :: F.FS | eff ) Unit
7979chmod = toAff2 A .chmod
8080
8181-- |
82- -- Gets file statistics.
83- --
82+ -- | Gets file statistics.
83+ -- |
8484stat :: forall eff . FilePath
8585 -> Aff (fs :: F.FS | eff ) Stats
8686stat = toAff1 A .stat
8787
8888-- |
89- -- Creates a link to an existing file.
90- --
89+ -- | Creates a link to an existing file.
90+ -- |
9191link :: forall eff . FilePath
9292 -> FilePath
9393 -> Aff (fs :: F.FS | eff ) Unit
9494link = toAff2 A .link
9595
9696-- |
97- -- Creates a symlink.
98- --
97+ -- | Creates a symlink.
98+ -- |
9999symlink :: forall eff . FilePath
100100 -> FilePath
101101 -> F.SymlinkType
102102 -> Aff (fs :: F.FS | eff ) Unit
103103symlink = toAff3 A .symlink
104104
105105-- |
106- -- Reads the value of a symlink.
107- --
106+ -- | Reads the value of a symlink.
107+ -- |
108108readlink :: forall eff . FilePath
109109 -> Aff (fs :: F.FS | eff ) FilePath
110110readlink = toAff1 A .readlink
111111
112112-- |
113- -- Find the canonicalized absolute location for a path.
114- --
113+ -- | Find the canonicalized absolute location for a path.
114+ -- |
115115realpath :: forall eff . FilePath
116116 -> Aff (fs :: F.FS | eff ) FilePath
117117realpath = toAff1 A .realpath
118118
119119-- |
120- -- Find the canonicalized absolute location for a path using a cache object for
121- -- already resolved paths.
122- --
120+ -- | Find the canonicalized absolute location for a path using a cache object
121+ -- | for already resolved paths.
122+ -- |
123123realpath' :: forall eff cache . FilePath
124124 -> { | cache }
125125 -> Aff (fs :: F.FS | eff ) FilePath
126126realpath' = toAff2 A .realpath'
127127
128128-- |
129- -- Deletes a file.
130- --
129+ -- | Deletes a file.
130+ -- |
131131unlink :: forall eff . FilePath
132132 -> Aff (fs :: F.FS | eff ) Unit
133133unlink = toAff1 A .unlink
134134
135135-- |
136- -- Deletes a directory.
137- --
136+ -- | Deletes a directory.
137+ -- |
138138rmdir :: forall eff . FilePath
139139 -> Aff (fs :: F.FS | eff ) Unit
140140rmdir = toAff1 A .rmdir
141141
142142-- |
143- -- Makes a new directory.
144- --
143+ -- | Makes a new directory.
144+ -- |
145145mkdir :: forall eff . FilePath
146146 -> Aff (fs :: F.FS | eff ) Unit
147147mkdir = toAff1 A .mkdir
148148
149149-- |
150- -- Makes a new directory with the specified permissions.
151- --
150+ -- | Makes a new directory with the specified permissions.
151+ -- |
152152mkdir' :: forall eff . FilePath
153153 -> Perms
154154 -> Aff (fs :: F.FS | eff ) Unit
155155mkdir' = toAff2 A .mkdir'
156156
157157-- |
158- -- Reads the contents of a directory.
159- --
158+ -- | Reads the contents of a directory.
159+ -- |
160160readdir :: forall eff . FilePath
161161 -> Aff (fs :: F.FS | eff ) [FilePath ]
162162readdir = toAff1 A .readdir
163163
164- -- |
165- -- Sets the accessed and modified times for the specified file.
166- --
164+ -- |
165+ -- | Sets the accessed and modified times for the specified file.
166+ -- |
167167utimes :: forall eff . FilePath
168168 -> Date
169169 -> Date
170170 -> Aff (fs :: F.FS | eff ) Unit
171171utimes = toAff3 A .utimes
172172
173173-- |
174- -- Reads the entire contents of a file returning the result as a raw buffer.
175- --
174+ -- | Reads the entire contents of a file returning the result as a raw buffer.
175+ -- |
176176readFile :: forall eff . FilePath
177177 -> Aff (fs :: F.FS | eff ) Buffer
178178readFile = toAff1 A .readFile
179179
180180-- |
181- -- Reads the entire contents of a text file with the specified encoding.
182- --
181+ -- | Reads the entire contents of a text file with the specified encoding.
182+ -- |
183183readTextFile :: forall eff . Encoding
184184 -> FilePath
185185 -> Aff (fs :: F.FS | eff ) String
186186readTextFile = toAff2 A .readTextFile
187187
188188-- |
189- -- Writes a buffer to a file.
190- --
189+ -- | Writes a buffer to a file.
190+ -- |
191191writeFile :: forall eff . FilePath
192192 -> Buffer
193193 -> Aff (fs :: F.FS | eff ) Unit
194194writeFile = toAff2 A .writeFile
195195
196196-- |
197- -- Writes text to a file using the specified encoding.
198- --
197+ -- | Writes text to a file using the specified encoding.
198+ -- |
199199writeTextFile :: forall eff . Encoding
200200 -> FilePath
201201 -> String
202202 -> Aff (fs :: F.FS | eff ) Unit
203203writeTextFile = toAff3 A .writeTextFile
204204
205205-- |
206- -- Appends the contents of a buffer to a file.
207- --
206+ -- | Appends the contents of a buffer to a file.
207+ -- |
208208appendFile :: forall eff . FilePath
209209 -> Buffer
210210 -> Aff (fs :: F.FS | eff ) Unit
211211appendFile = toAff2 A .appendFile
212212
213213-- |
214- -- Appends text to a file using the specified encoding.
215- --
214+ -- | Appends text to a file using the specified encoding.
215+ -- |
216216appendTextFile :: forall eff . Encoding
217217 -> FilePath
218218 -> String
@@ -226,6 +226,9 @@ import Data.Function
226226foreign import fs " var fs = require('fs');" ::
227227 { exists :: forall a . Fn2 FilePath (Boolean -> a ) Unit }
228228
229+ -- |
230+ -- | Check to see if a file exists.
231+ -- |
229232exists :: forall eff . String
230233 -> Aff (fs :: F.FS | eff ) Boolean
231234exists file = makeAff \_ a -> pure $ runFn2 fs.exists file a
0 commit comments