narek narek - 1 year ago 199
Javascript Question

Write results into a file using CasperJS

How do I create a file in the file system and place the contents of

inside it?

Answer Source
var fs = require('fs');
fs.write(myfile, myData, 'w');

for saving daily scrapes I do:

var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var myfile = "data-"+year + "-" + month + "-" + day+".html";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download