rescript-nodejs
rescript-nodejs copied to clipboard
readFileSyncWith should return string
--- a/src/Fs.res
+++ b/src/Fs.res
@@ -248,7 +248,7 @@ external openSyncWith: (string, ~flag: Flag.t=?, ~mode: int=?) => fd = "openSync
@module("node:fs")
external readFileSync: string => Buffer.t = "readFileSync"
@module("node:fs")
-external readFileSyncWith: (string, readFileOptions) => Buffer.t = "readFileSync"
+external readFileSyncWith: (string, readFileOptions) => string = "readFileSync"
@module("node:fs") external existsSync: string => bool = "existsSync"
If it's true there, it would be true of readFileSync as well.
Turns out the return value is based on the encoding option:
https://nodejs.org/api/fs.html#filehandlereadfileoptions
That's going to be interesting to bind.
The same goes for write, I think