Now I show the information using:
console.log (kraken.id, markets)
However, I want to write all the information that goes to the console to a file instead. How can that be done by completing the below code?
'use strict';
var ccxt = require('ccxt');
(async () => {
let kraken = new ccxt.kraken()
let markets = await kraken.load_markets()
//console.log (kraken.id, markets)
//How to write above console.log to file?
const fs = require('fs');
fs.writeFile("/Users/Andreas/Desktop/NODE/myproject/files/test.txt", "allinfoAsstring", function (err) {
if (err) {
return console.log(err);
}
console.log("The file was saved!");
});
})()