@@ -329,6 +329,155 @@ module FileHandle = {
329329 external writeFileWith : (t , Buffer .t , writeFileOptions ) => Js .Promise .t <unit > = "writeFile"
330330}
331331
332+ module PromiseAPI_ = {
333+ @module ("fs" ) @scope ("promises" )
334+ external access : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )] => Js .Promise .t <unit > =
335+ "access"
336+ @module ("fs" ) @scope ("promises" )
337+ external accessWithMode : (
338+ @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
339+ ~mode : int ,
340+ ) => Js .Promise .t <unit > = "access"
341+
342+ type appendFileStrOptions
343+ @obj
344+ external appendFileStrOptions : (
345+ ~encoding : string = ?,
346+ ~mode : int = ?,
347+ ~flag : Flag .t = ?,
348+ unit ,
349+ ) => appendFileStrOptions = ""
350+ @module ("fs" ) @scope ("promises" )
351+ external appendFile : (
352+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t ) | #Handle (FileHandle .t )],
353+ ~data : string ,
354+ ) => Js .Promise .t <unit > = "appendFile"
355+
356+ @module ("fs" ) @scope ("promises" )
357+ external appendFileWith : (
358+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t ) | #Handle (FileHandle .t )],
359+ ~data : string ,
360+ ~options : appendFileStrOptions ,
361+ ) => Js .Promise .t <unit > = "appendFile"
362+
363+ type appendFileBufferOptions
364+ @obj
365+ external appendFileBufferOptions : (
366+ ~mode : int = ?,
367+ ~flag : Flag .t = ?,
368+ unit ,
369+ ) => appendFileBufferOptions = ""
370+
371+ @module ("fs" ) @scope ("promises" )
372+ external appendFileBuffer : (
373+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t ) | #Handle (FileHandle .t )],
374+ ~data : Buffer .t ,
375+ ) => Js .Promise .t <unit > = "appendFile"
376+
377+ @module ("fs" ) @scope ("promises" )
378+ external appendFileBufferWith : (
379+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t ) | #Handle (FileHandle .t )],
380+ ~data : Buffer .t ,
381+ ~options : appendFileBufferOptions ,
382+ ) => Js .Promise .t <unit > = "appendFile"
383+
384+ @module ("fs" ) @scope ("promises" )
385+ external chmod : (
386+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
387+ ~mode : int ,
388+ ) => Js .Promise .t <unit > = "chmod"
389+
390+ @module ("fs" ) @scope ("promises" )
391+ external chown : (
392+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
393+ ~uid : int ,
394+ ~gid : int ,
395+ ) => Js .Promise .t <unit > = "chown"
396+
397+ @module ("fs" ) @scope ("promises" )
398+ external copyFile : (
399+ ~src : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
400+ ~dest : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
401+ ) => Js .Promise .t <unit > = "copyFile"
402+
403+ @module ("fs" ) @scope ("promises" )
404+ external copyFileFlag : (
405+ ~src : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
406+ ~dest : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
407+ ~flags : Constants .t ,
408+ ) => Js .Promise .t <unit > = "copyFile"
409+
410+ @module ("fs" ) @scope ("promises" )
411+ external lchmod : (~path : @unwrap [#Str (string )], ~mode : int ) => Js .Promise .t <unit > = "lchmod"
412+
413+ @module ("fs" ) @scope ("promises" )
414+ external link : (
415+ ~existingPath : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
416+ ~newPath : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
417+ ) => Js .Promise .t <unit > = "link"
418+
419+ type statOptions = {bigint : int }
420+ @module ("fs" ) @scope ("promises" )
421+ external lstat : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )] => Js .Promise .t <
422+ Stats .t ,
423+ > = "lstat"
424+
425+ @module ("fs" ) @scope ("promises" )
426+ external lstatBigInt : (
427+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
428+ ~options : statOptions ,
429+ ) => Js .Promise .t <Stats .t > = "lstat"
430+
431+ type mkdirOptions
432+ @obj
433+ external mkdirOptions : (~recursive : bool = ?, ~mode : int = ?, unit ) => mkdirOptions = ""
434+
435+ @module ("fs" ) @scope ("promises" )
436+ external mkdir : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )] => Js .Promise .t <unit > =
437+ "mkdir"
438+
439+ @module ("fs" ) @scope ("promises" )
440+ external mkdirWith : (
441+ @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
442+ mkdirOptions ,
443+ ) => Js .Promise .t <unit > = "mkdir"
444+
445+ type mkdtempOptions
446+ @obj external mdktempOptions : (~encoding : string = ?, unit ) => mkdtempOptions = ""
447+
448+ @module ("fs" ) @scope ("promises" )
449+ external mkdtemp : string => Js .Promise .t <string > = "mkddtemp"
450+
451+ @module ("fs" ) @scope ("promises" )
452+ external mkdtempWith : (
453+ ~prefix : string ,
454+ ~mkdtempOptions : @unwrap [#Str (string ) | #Option (mkdtempOptions )],
455+ ) => Js .Promise .t <string > = "mkddtemp"
456+
457+ @module ("fs" ) @scope ("promises" )
458+ external open_ : (
459+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
460+ ~flags : Flag .t ,
461+ ) => Js .Promise .t <FileHandle .t > = "open"
462+
463+ @module ("fs" ) @scope ("promises" )
464+ external openWithMode : (
465+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
466+ ~flags : Flag .t ,
467+ ~mode : int ,
468+ ) => Js .Promise .t <FileHandle .t > = "open"
469+
470+ @module ("fs" ) @scope ("promises" )
471+ external stat : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )] => Js .Promise .t <Stats .t > =
472+ "lstat"
473+
474+ @module ("fs" ) @scope ("promises" )
475+ external statWith : (
476+ ~path : @unwrap [#Str (string ) | #Buffer (Buffer .t ) | #URL (Url .t )],
477+ ~options : statOptions ,
478+ ) => Js .Promise .t <Stats .t > = "lstat"
479+ }
480+
332481@module ("fs" ) @scope ("promises" )
333482external access : string => Js .Promise .t <unit > = "access"
334483@module ("fs" ) @scope ("promises" )
0 commit comments