Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readFileSyncWith should return string #27

Open
punund opened this issue Mar 11, 2024 · 2 comments
Open

readFileSyncWith should return string #27

punund opened this issue Mar 11, 2024 · 2 comments

Comments

@punund
Copy link

punund commented Mar 11, 2024

--- 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"
@TheSpyder
Copy link
Owner

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.

@vadimyen
Copy link

vadimyen commented Jun 9, 2024

The same goes for write, I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants