javascript – How to turn nodeJS scraper results into a CSV file?

I’m using the nodeJS scraper below that scrapes the google play store. However, I’d like the results to show up in a CSV file. Currently it just runs in console:

Secondly, I would like to somehow combine the “search” and “app detail” functions so that I could search a term and return the App title, developer name, app URL, and developer email.

Search function:

var gplay = require('google-play-scraper');{
    term: "panda",
    num: 2
  }).then(console.log, console.log);

App Details Function:

var gplay = require('google-play-scraper');{appId: ''})
  .then(console.log, console.log);