SyntaxError Octal escape sequences are not allowed in strict mode.

I have a path to a file system, but when I use ts-node, it throws an error. How should I rewrite this so that I can get the file to work?

Relevant Potion of code:
const DATAPATH = "C:\path\to\repo\advent-of-code\2022\01\data.txt";

const data = readFileSync(DATAPATH, "utf-8");


Error:
> ts-node ./lib/main.ts exec "-d" "2022-1"

C:\path\to\repo\advent-of-code\2022\01\runner.ts:10
const DATAPATH = `${"C:\path\to\repo\advent-of-code\2022\01\data.txt"}`;
                                                         ^

SyntaxError: Octal escape sequences are not allowed in strict mode.
Was this page helpful?