Skip to content

Commit a63354b

Browse files
committed
Disabled warning 44 so the example can use open NodeJs
1 parent 91dea13 commit a63354b

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

bsconfig.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"@dusty-phillips/rescript-zora",
3030
"@ryyppy/rescript-promise"
3131
],
32-
"ppx-flags": [],
33-
"bsc-flags": []
34-
}
32+
"warnings": {
33+
"number": "A-4-40-41-42-43-44+101-102-103",
34+
"error": "false"
35+
}
36+
}

examples/StreamTextToFile.res

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
/*
2-
Normally `open NodeJs` would be used to shorten the module accessors
3-
this is not done in the example to make it clear where things come from.
1+
open NodeJs
2+
let data = "Sample text to write to a file!"->Buffer.fromString
3+
let process = Process.process
44

5-
Note this means compiling the codebase from clean will trigger an error
6-
just rebuild and it'll be fine.
7-
*/
5+
let outputPath = Path.relative(~from=Process.cwd(process), ~to_="example__output.txt")
86

9-
let data = "Sample text to write to a file!"->NodeJs.Buffer.fromString
10-
let process = NodeJs.Process.process
11-
12-
let outputPath = NodeJs.Path.relative(~from=NodeJs.Process.cwd(process), ~to_="example__output.txt")
13-
14-
let writeStream = NodeJs.Fs.createWriteStream(outputPath)
7+
let writeStream = Fs.createWriteStream(outputPath)
158

169
let logErrorIfExists = maybeError =>
1710
switch Js.Nullable.toOption(maybeError) {
@@ -21,7 +14,7 @@ let logErrorIfExists = maybeError =>
2114

2215
let () =
2316
writeStream
24-
->NodeJs.Stream.writeWith(
17+
->Stream.writeWith(
2518
data,
2619
~callback=maybeError => {
2720
logErrorIfExists(maybeError)

0 commit comments

Comments
 (0)