1
1
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
2
- *
2
+ *
3
3
* This program is free software: you can redistribute it and/or modify
4
4
* it under the terms of the GNU Lesser General Public License as published by
5
5
* the Free Software Foundation, either version 3 of the License, or
17
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
19
* GNU Lesser General Public License for more details.
20
- *
20
+ *
21
21
* You should have received a copy of the GNU Lesser General Public License
22
22
* along with this program; if not, write to the Free Software
23
23
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
31
31
callback is used that rethrows errors. To get a trace to the original call
32
32
site, set the `NODE_DEBUG` environment variable:
33
33
*)
34
- external readdirSync : string -> string array = " " [@@ bs.module "fs" ]
34
+ external readdirSync : string -> string array = " " [@@ bs.module "fs" ]
35
35
36
- external renameSync : string -> string = " " [@@ bs.module "fs" ]
36
+ external renameSync : string -> string = " " [@@ bs.module "fs" ]
37
37
38
- type fd = private int
38
+ type fd = Node_fs2 .fd
39
39
40
40
type path = string
41
41
(* *
42
42
The relative path to a filename can be used. Remember, however, that this path
43
43
will be relative to [process.cwd()].
44
- *)
44
+ *)
45
45
46
- module Watch = struct
47
- type t
48
- type config
46
+ module Watch = struct
47
+ type t = Node_fs2.Watch .t
48
+ type config = Node_fs2.Watch .config
49
49
external config :
50
50
?persistent: bool ->
51
- ?recursive: bool ->
52
- ?encoding: Js_string .t ->
53
- unit -> config =
51
+ ?recursive: bool ->
52
+ ?encoding: Js_string .t ->
53
+ unit -> config =
54
54
"" [@@ bs.obj]
55
55
56
56
external watch :
57
- string ->
58
- ?config:config ->
59
- unit ->
60
- t = ""
57
+ string ->
58
+ ?config:config ->
59
+ unit ->
60
+ t = ""
61
61
[@@ bs.module "fs" ]
62
- (* * there is no need to accept listener, since we return a [watcher]
62
+ (* * there is no need to accept listener, since we return a [watcher]
63
63
back it can register event listener there .
64
- Currently we introduce a type [string_buffer], for the
65
- [filename], it will be [Buffer] when the encoding is `utf8.
66
- This is dependent type which can be tracked by GADT in some way,
64
+ Currently we introduce a type [string_buffer], for the
65
+ [filename], it will be [Buffer] when the encoding is `utf8.
66
+ This is dependent type which can be tracked by GADT in some way,
67
67
but to make things simple, let's just introduce an or type
68
68
*)
69
69
external on :
70
70
([
71
71
`change of (string (* eventType*) -> Node .string_buffer (* filename *) -> unit [@ bs])
72
72
| `error of (unit -> unit [@ bs])
73
73
] [@ bs.string ]
74
- ) -> t = ""
74
+ ) -> t = ""
75
75
[@@ bs.send.pipe: t ]
76
76
77
77
78
78
external close : unit = " " [@@ bs.send.pipe:t]
79
79
end
80
80
81
- external ftruncateSync : fd -> int -> unit = " " [@@ bs.module "fs" ]
81
+ external ftruncateSync : fd -> int -> unit = " " [@@ bs.module "fs" ]
82
82
83
- external truncateSync : string -> int -> unit = " " [@@ bs.module "fs" ]
83
+ external truncateSync : string -> int -> unit = " " [@@ bs.module "fs" ]
84
84
85
- external chownSync : string -> uid :int -> gid :int -> unit = " " [@@ bs.module "fs" ]
85
+ external chownSync : string -> uid :int -> gid :int -> unit = " " [@@ bs.module "fs" ]
86
86
87
- external fchownSync : fd -> uid :int -> gid :int -> unit = " " [@@ bs.module "fs" ]
87
+ external fchownSync : fd -> uid :int -> gid :int -> unit = " " [@@ bs.module "fs" ]
88
88
89
89
external readlinkSync : string -> string = " " [@@ bs.module "fs" ]
90
90
@@ -93,7 +93,7 @@ external unlinkSync : string -> unit = "" [@@bs.module "fs"]
93
93
external rmdirSync : string -> unit = " " [@@ bs.module "fs" ]
94
94
95
95
(* TODO: [flags] support *)
96
- external openSync :
96
+ external openSync :
97
97
path ->
98
98
(
99
99
[ `Read [@ bs.as "r" ]
@@ -111,29 +111,29 @@ external openSync :
111
111
unit = " " [@@ bs.module "fs" ]
112
112
113
113
114
- external readFileSync :
114
+ external readFileSync :
115
115
string ->
116
- (
116
+ (
117
117
[
118
118
`hex
119
119
| `utf8
120
- | `ascii
120
+ | `ascii
121
121
| `latin1
122
- | `base64
122
+ | `base64
123
123
| `ucs2
124
124
| `base64
125
- | `binary
125
+ | `binary
126
126
| `utf16le ][@ bs.string ]) ->
127
- string = " readFileSync"
127
+ string = " readFileSync"
128
128
[@@ bs.val] [@@ bs.module "fs" ]
129
129
130
- external readFileAsUtf8Sync :
131
- string -> (_ [@ bs.as "utf8" ]) ->
130
+ external readFileAsUtf8Sync :
131
+ string -> (_ [@ bs.as "utf8" ]) ->
132
132
string = " readFileSync"
133
- [@@ bs.val] [@@ bs.module "fs" ]
133
+ [@@ bs.val] [@@ bs.module "fs" ]
134
134
135
135
external existsSync : string -> bool = " "
136
- [@@ bs.val] [@@ bs.module "fs" ]
136
+ [@@ bs.val] [@@ bs.module "fs" ]
137
137
138
138
external writeFileSync :
139
139
string ->
0 commit comments