Skip to content

Instantly share code, notes, and snippets.

@nbogie
Last active December 2, 2022 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbogie/7dac3b112f54d04821631eaa233abb6d to your computer and use it in GitHub Desktop.
Save nbogie/7dac3b112f54d04821631eaa233abb6d to your computer and use it in GitHub Desktop.
TypeScript starter function for advent of code
import fs from 'fs/promises';
async function readFileAndSolveProblem() {
const inputRaw = await fs.readFile("./inputs/inputDay1A.txt", { encoding: 'utf8' })
const inputLines: string[] = inputRaw.split("\n");
console.log({ inputLines })
//TODO: solve the problem here, based on inputLines
}
readFileAndSolveProblem()
@nbogie
Copy link
Author

nbogie commented Dec 2, 2022

This would assume that in your project root directory you have a dir called inputs with just the input text in a file called inputDay1A.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment