@@ -39,180 +39,180 @@ import qualified Node.FS.Async as A
39
39
toAff :: forall eff a .
40
40
(A.Callback eff a -> Eff (fs :: F.FS | eff ) Unit ) ->
41
41
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
43
43
44
44
toAff1 f a = toAff (f a)
45
45
toAff2 f a b = toAff (f a b)
46
46
toAff3 f a b c = toAff (f a b c)
47
47
48
48
-- |
49
- -- Renames a file.
50
- --
49
+ -- | Rename a file.
50
+ -- |
51
51
rename :: forall eff . FilePath
52
52
-> FilePath
53
53
-> Aff (fs :: F.FS | eff ) Unit
54
54
rename = toAff2 A .rename
55
55
56
56
-- |
57
- -- Truncates a file to the specified length.
58
- --
57
+ -- | Truncates a file to the specified length.
58
+ -- |
59
59
truncate :: forall eff . FilePath
60
60
-> Number
61
61
-> Aff (fs :: F.FS | eff ) Unit
62
62
truncate = toAff2 A .truncate
63
63
64
64
-- |
65
- -- Changes the ownership of a file.
66
- --
65
+ -- | Changes the ownership of a file.
66
+ -- |
67
67
chown :: forall eff . FilePath
68
68
-> Number
69
69
-> Number
70
70
-> Aff (fs :: F.FS | eff ) Unit
71
71
chown = toAff3 A .chown
72
72
73
73
-- |
74
- -- Changes the permissions of a file.
75
- --
74
+ -- | Changes the permissions of a file.
75
+ -- |
76
76
chmod :: forall eff . FilePath
77
77
-> Perms
78
78
-> Aff (fs :: F.FS | eff ) Unit
79
79
chmod = toAff2 A .chmod
80
80
81
81
-- |
82
- -- Gets file statistics.
83
- --
82
+ -- | Gets file statistics.
83
+ -- |
84
84
stat :: forall eff . FilePath
85
85
-> Aff (fs :: F.FS | eff ) Stats
86
86
stat = toAff1 A .stat
87
87
88
88
-- |
89
- -- Creates a link to an existing file.
90
- --
89
+ -- | Creates a link to an existing file.
90
+ -- |
91
91
link :: forall eff . FilePath
92
92
-> FilePath
93
93
-> Aff (fs :: F.FS | eff ) Unit
94
94
link = toAff2 A .link
95
95
96
96
-- |
97
- -- Creates a symlink.
98
- --
97
+ -- | Creates a symlink.
98
+ -- |
99
99
symlink :: forall eff . FilePath
100
100
-> FilePath
101
101
-> F.SymlinkType
102
102
-> Aff (fs :: F.FS | eff ) Unit
103
103
symlink = toAff3 A .symlink
104
104
105
105
-- |
106
- -- Reads the value of a symlink.
107
- --
106
+ -- | Reads the value of a symlink.
107
+ -- |
108
108
readlink :: forall eff . FilePath
109
109
-> Aff (fs :: F.FS | eff ) FilePath
110
110
readlink = toAff1 A .readlink
111
111
112
112
-- |
113
- -- Find the canonicalized absolute location for a path.
114
- --
113
+ -- | Find the canonicalized absolute location for a path.
114
+ -- |
115
115
realpath :: forall eff . FilePath
116
116
-> Aff (fs :: F.FS | eff ) FilePath
117
117
realpath = toAff1 A .realpath
118
118
119
119
-- |
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
+ -- |
123
123
realpath' :: forall eff cache . FilePath
124
124
-> { | cache }
125
125
-> Aff (fs :: F.FS | eff ) FilePath
126
126
realpath' = toAff2 A .realpath'
127
127
128
128
-- |
129
- -- Deletes a file.
130
- --
129
+ -- | Deletes a file.
130
+ -- |
131
131
unlink :: forall eff . FilePath
132
132
-> Aff (fs :: F.FS | eff ) Unit
133
133
unlink = toAff1 A .unlink
134
134
135
135
-- |
136
- -- Deletes a directory.
137
- --
136
+ -- | Deletes a directory.
137
+ -- |
138
138
rmdir :: forall eff . FilePath
139
139
-> Aff (fs :: F.FS | eff ) Unit
140
140
rmdir = toAff1 A .rmdir
141
141
142
142
-- |
143
- -- Makes a new directory.
144
- --
143
+ -- | Makes a new directory.
144
+ -- |
145
145
mkdir :: forall eff . FilePath
146
146
-> Aff (fs :: F.FS | eff ) Unit
147
147
mkdir = toAff1 A .mkdir
148
148
149
149
-- |
150
- -- Makes a new directory with the specified permissions.
151
- --
150
+ -- | Makes a new directory with the specified permissions.
151
+ -- |
152
152
mkdir' :: forall eff . FilePath
153
153
-> Perms
154
154
-> Aff (fs :: F.FS | eff ) Unit
155
155
mkdir' = toAff2 A .mkdir'
156
156
157
157
-- |
158
- -- Reads the contents of a directory.
159
- --
158
+ -- | Reads the contents of a directory.
159
+ -- |
160
160
readdir :: forall eff . FilePath
161
161
-> Aff (fs :: F.FS | eff ) [FilePath ]
162
162
readdir = toAff1 A .readdir
163
163
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
+ -- |
167
167
utimes :: forall eff . FilePath
168
168
-> Date
169
169
-> Date
170
170
-> Aff (fs :: F.FS | eff ) Unit
171
171
utimes = toAff3 A .utimes
172
172
173
173
-- |
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
+ -- |
176
176
readFile :: forall eff . FilePath
177
177
-> Aff (fs :: F.FS | eff ) Buffer
178
178
readFile = toAff1 A .readFile
179
179
180
180
-- |
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
+ -- |
183
183
readTextFile :: forall eff . Encoding
184
184
-> FilePath
185
185
-> Aff (fs :: F.FS | eff ) String
186
186
readTextFile = toAff2 A .readTextFile
187
187
188
188
-- |
189
- -- Writes a buffer to a file.
190
- --
189
+ -- | Writes a buffer to a file.
190
+ -- |
191
191
writeFile :: forall eff . FilePath
192
192
-> Buffer
193
193
-> Aff (fs :: F.FS | eff ) Unit
194
194
writeFile = toAff2 A .writeFile
195
195
196
196
-- |
197
- -- Writes text to a file using the specified encoding.
198
- --
197
+ -- | Writes text to a file using the specified encoding.
198
+ -- |
199
199
writeTextFile :: forall eff . Encoding
200
200
-> FilePath
201
201
-> String
202
202
-> Aff (fs :: F.FS | eff ) Unit
203
203
writeTextFile = toAff3 A .writeTextFile
204
204
205
205
-- |
206
- -- Appends the contents of a buffer to a file.
207
- --
206
+ -- | Appends the contents of a buffer to a file.
207
+ -- |
208
208
appendFile :: forall eff . FilePath
209
209
-> Buffer
210
210
-> Aff (fs :: F.FS | eff ) Unit
211
211
appendFile = toAff2 A .appendFile
212
212
213
213
-- |
214
- -- Appends text to a file using the specified encoding.
215
- --
214
+ -- | Appends text to a file using the specified encoding.
215
+ -- |
216
216
appendTextFile :: forall eff . Encoding
217
217
-> FilePath
218
218
-> String
@@ -226,6 +226,9 @@ import Data.Function
226
226
foreign import fs " var fs = require('fs');" ::
227
227
{ exists :: forall a . Fn2 FilePath (Boolean -> a ) Unit }
228
228
229
+ -- |
230
+ -- | Check to see if a file exists.
231
+ -- |
229
232
exists :: forall eff . String
230
233
-> Aff (fs :: F.FS | eff ) Boolean
231
234
exists file = makeAff \_ a -> pure $ runFn2 fs.exists file a
0 commit comments