@@ -73,14 +73,68 @@ module Stats = {
7373};
7474
7575module Constants = {
76- [@ bs . module "fs" ] [@ bs . val ] [@ bs . scope "constants" ]
77- external f_ok : int = "F_OK" ;
78- [@ bs . module "fs" ] [@ bs . val ] [@ bs . scope "constants" ]
79- external w_ok : int = "W_OK" ;
80- [@ bs . module "fs" ] [@ bs . val ] [@ bs . scope "constants" ]
81- external r_ok : int = "R_OK" ;
82- [@ bs . module "fs" ] [@ bs . val ] [@ bs . scope "constants" ]
83- external x_ok : int = "X_OK" ;
76+ type t = pri int ;
77+
78+ /** Bitwise 'or' i.e. JavaScript [x | y] */
79+ external (lor ): (t , t ) => t = "% orint " ;
80+
81+ [@ text "{1 File Access Constants}" ];
82+
83+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external f_ok : t = "F_OK" ;
84+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external w_ok : t = "W_OK" ;
85+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external r_ok : t = "R_OK" ;
86+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external x_ok : t = "X_OK" ;
87+
88+ [@ text "{1 File Copy Constants}" ];
89+
90+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external copyfile_excl : t = "COPYFILE_EXCL" ;
91+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external copyfile_ficlone : t = "COPYFILE_FICLONE" ;
92+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external copyfile_ficlone_force : t = "COPYFILE_FICLONE_FORCE" ;
93+
94+ [@ text "{1 File Open Constants}" ];
95+
96+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_rdonly : t = "O_RDONLY" ;
97+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_wronly : t = "O_WRONLY" ;
98+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_rdwr : t = "O_RDWR" ;
99+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_creat : t = "O_CREAT" ;
100+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_excl : t = "O_EXCL" ;
101+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_noctty : t = "O_NOCTTY" ;
102+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_trunc : t = "O_TRUNC" ;
103+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_append : t = "O_APPEND" ;
104+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_directory : t = "O_DIRECTORY" ;
105+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_noatime : t = "O_NOATIME" ;
106+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_nofollow : t = "O_NOFOLLOW" ;
107+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_sync : t = "O_SYNC" ;
108+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_dsync : t = "O_DSYNC" ;
109+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_symlink : t = "O_SYMLINK" ;
110+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_direct : t = "O_DIRECT" ;
111+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external o_nonblock : t = "O_NONBLOCK" ;
112+
113+ [@ text "{1 File Type Constants}" ];
114+
115+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ifmt : t = "S_IFMT" ;
116+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ifreg : t = "S_IFREG" ;
117+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ifdir : t = "S_IFDIR" ;
118+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ifchr : t = "S_IFCHR" ;
119+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ifblk : t = "S_IFBLK" ;
120+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ififo : t = "S_IFIFO" ;
121+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_iflnk : t = "S_IFLNK" ;
122+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ifsock : t = "S_IFSOCK" ;
123+
124+ [@ text "{1 File Mode Constants}" ];
125+
126+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_irwxu : t = "S_IRWXU" ;
127+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_irusr : t = "S_IRUSR" ;
128+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_iwusr : t = "S_IWUSR" ;
129+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ixusr : t = "S_IXUSR" ;
130+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_irwxg : t = "S_IRWXG" ;
131+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_irgrp : t = "S_IRGRP" ;
132+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_iwgrp : t = "S_IWGRP" ;
133+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ixgrp : t = "S_IXGRP" ;
134+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_irwxo : t = "S_IRWXO" ;
135+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_iroth : t = "S_IROTH" ;
136+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_iwoth : t = "S_IWOTH" ;
137+ [@ bs . module "fs" ] [@ bs . scope "constants" ] external s_ixoth : t = "S_IXOTH" ;
84138};
85139
86140module Flag : {
@@ -305,7 +359,7 @@ external copyFile: (string, ~dest: string) => Js.Promise.t(unit) = "copyFile";
305359
306360[@ bs . module "fs" ] [@ bs . scope "promises" ]
307361external copyFileFlag :
308- (string , ~dest : string , ~flag : string ) => Js . Promise . t (unit ) =
362+ (string , ~dest : string , ~flags : Constants . t ) => Js . Promise . t (unit ) =
309363 "copyFile" ;
310364
311365[@ bs . module "fs" ] [@ bs . scope "promises" ]
0 commit comments