67056efa52a69a9838760ad5a6ec7509538cf6cb
Christian Fraß [add] typescript logic

Christian Fraß authored 3 years ago

1) namespace helpers.file
2) {
3) 	
4) 	/**
5) 	 */
6) 	export function read
7) 	(
8) 		path : string
9) 	) : string
10) 	{
11) 		const nm_fs = require("fs");
12) 		const buffer : Buffer = nm_fs.readFileSync(path);
13) 		const content : string = buffer.toString();
14) 		return content;
15) 	}
16) 	
Christian Fraß [mod] makefile

Christian Fraß authored 3 years ago

17) 	
18) 	/**
19) 	 */
20) 	export function write
21) 	(
22) 		path : string,
23) 		content : string
24) 	) : Promise<void>
25) 	{
26) 		const nm_fs = require("fs");
27) 		return (
28) 			new Promise<void>
29) 			(
30) 				(resolve, reject) =>
31) 				{
Christian Fraß [fix] helper:file

Christian Fraß authored 3 years ago

32) 					nm_fs.writeFile
Christian Fraß [mod] makefile

Christian Fraß authored 3 years ago

33) 					(
34) 						path,
35) 						content,
36) 						(error) =>
37) 						{
38) 							if (error) reject(error);
39) 							else resolve(undefined);
40) 						}
41) 					);
42) 				}
43) 			)
44) 		);
45) 	}
46)