I don't have any background with angular or typescript. I'm a Data Scientist but currently we have to write a code in typescript that writes something into a file everytime a function is called. I followed the Tour of Heroes tutorial just for testing (https://angular.io/tutorial) and then I tried to create this:
var fName = arguments.callee.toString().match(/function ([^\(]+)/)[1];
var currentdate = new Date();
var datetime = 'Last Sync: ' + currentdate.getDate() + '/'
+ (currentdate.getMonth()+1) + '/'
+ currentdate.getFullYear() + ' @ '
+ currentdate.getHours() + ':'
+ currentdate.getMinutes() + ':'
+ currentdate.getSeconds() + ':'
+ currentdate.getMilliseconds();
const fs = require('fs');
fs.appendFile('logs.txt', 'C1 F0 ' + datetime, function (err) {
if (err) throw err;
});
But this gives me an error saying Can't resolve 'fs'
I've already seen that it's normal because it's a client-side framework. So any workarounds or any solutions?
Thanks in advance and sorry if I said something wrong.