I've updated node to the latest version. Here's a piece of code
const fs = require('fs');
const textIn = fs.readFileSync('./txt/input.txt','utf-8');
console.log(textIn);
const textOut = 'This is what we know: ${textIn}.\nCreated on ${Date.now()}';
fs.writeFileSync('./txt/output.txt', textOut);
console.log('File Written!');
The problem is I could generate an output file while ${textIn}
is taken as a string
You are using template literals, so you need backticks instead of double or single quotes:
const textOut = `This is what we know: ${textIn}.\nCreated on ${Date.now()}`;