File tree Expand file tree Collapse file tree 3 files changed +35
-344
lines changed
Expand file tree Collapse file tree 3 files changed +35
-344
lines changed Original file line number Diff line number Diff line change 1-
2- let data = "Sample text to write to a file!" -> Buffer . fromString;
1+ let data = "Sample text to write to a file!" -> Buffer . fromString;
32let process = Process . process;
43
5- let outputPath = Path . relative(
6- ~from= Process . cwd(process),
7- ~to_= "example__output.txt"
8- );
4+ let outputPath =
5+ Path . relative(~from= Process . cwd(process), ~to_= "example__output.txt" );
96
107let writeStream = Fs . createWriteStream(outputPath);
118
12- let logErrorIfExists = (maybeError) => {
13- switch (Js . Nullable . toOption(maybeError)) {
14- | Some (err ) => Js . log2("An error occurred" , err);
15- | None => () ;
16- };
17- }
18-
19- writeStream -> Stream . writeWith(
20- data,
21- ~callback= (maybeError) => {
22- logErrorIfExists(maybeError);
23- Js . log("Finished" );
24- },
25- ()
26- );
9+ let logErrorIfExists = maybeError => {
10+ switch (Js . Nullable . toOption(maybeError)) {
11+ | Some (err ) => Js . log2("An error occurred" , err)
12+ | None => ()
13+ };
14+ };
2715
16+ let () =
17+ writeStream
18+ -> Stream . writeWith(
19+ data,
20+ ~callback=
21+ maybeError => {
22+ logErrorIfExists(maybeError);
23+ Js . log("Finished" );
24+ },
25+ () ,
26+ )
27+ -> ignore ;
Original file line number Diff line number Diff line change 1717 "homepage" : " https://github.com/sikanhe/reason-node" ,
1818 "license" : " MIT" ,
1919 "dependencies" : {},
20- "peerDependencies" : {
21- "bs-platform" : " >= 7.3.2"
22- },
2320 "devDependencies" : {
2421 "@glennsl/bs-jest" : " ^0.4.10" ,
25- "bs-platform" : " 7 .3.2 "
22+ "bs-platform" : " ^8 .3.0 "
2623 }
2724}
You can’t perform that action at this time.
0 commit comments