|
@@ -0,0 +1,18 @@
|
|
|
+import * as fs from "fs";
|
|
|
+import * as readline from "readline";
|
|
|
+
|
|
|
+export async function LoadInput(dayNumber: number): Promise<string[]> {
|
|
|
+ const contents = [];
|
|
|
+ const stream = fs.createReadStream(`./inputs/${dayNumber}.txt`, "utf8");
|
|
|
+
|
|
|
+ const rl = readline.createInterface({
|
|
|
+ input: stream,
|
|
|
+ crlfDelay: Infinity,
|
|
|
+ });
|
|
|
+
|
|
|
+ for await (const line of rl) {
|
|
|
+ contents.push(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ return contents;
|
|
|
+}
|