function save_response(data) {
    if (Object.keys(data).length > 0) {
        var transformStream = JSONStream.stringify();
        var outputStream = fs.createWriteStream(__dirname + `/data_download_${new Date().toISOString()}.json`);
        transformStream.pipe(outputStream);
        Object.keys(data).forEach(key => {
            data[key].forEach(transformStream.write);
        })
        transformStream.end();
        outputStream.on("finish", function handleFinish() {
            console.log(chalk.green("JSONStream serialization complete!"));
            console.log("- - - - - - - - - - - - - - - - - - - - - - -");
        });
    }
}
/*
--- SAVE RESPONSE ---
Save response as a .json file if the settings.save flag is true
*/
SAVE RESPONSE
Save response as a .json file if the settings.save flag is true
SAVE RESPONSE Save response as a . json file if the settings . save flag is true
function save_response(data) {
    if (Object.keys(data).length > 0) {
        var transformStream = JSONStream.stringify();
        var outputStream = fs.createWriteStream(__dirname + `/data_download_${new Date().toISOString()}.json`);
        transformStream.pipe(outputStream);
        Object.keys(data).forEach(key => {
            data[key].forEach(transformStream.write);
        })
        transformStream.end();
        outputStream.on("finish", function handleFinish() {
            console.log(chalk.green("JSONStream serialization complete!"));
            console.log("- - - - - - - - - - - - - - - - - - - - - - -");
        });
    }
}
function save_response ( data ) { if ( Object . keys ( data ) . length > 0 ) { var transformStream = JSONStream . stringify ( ) ; var outputStream = fs . createWriteStream ( __dirname + ` ${ new Date ( ) . toISOString ( ) } ` ) ; transformStream . pipe ( outputStream ) ; Object . keys ( data ) . forEach ( key => { data [ key ] . forEach ( transformStream . write ) ; } ) transformStream . end ( ) ; outputStream . on ( "finish" , function handleFinish ( ) { console . log ( chalk . green ( "JSONStream serialization complete!" ) ) ; console . log ( "- - - - - - - - - - - - - - - - - - - - - - -" ) ; } ) ; } }
SAVE RESPONSE
Save response as a .json file if the settings.save flag is true
SAVE RESPONSE Save response as a . json file if the settings . save flag is true