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:

https://github.com/facundoolano/google-play-scraper

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');

gplay.search({
    term: "panda",
    num: 2
  }).then(console.log, console.log);

App Details Function:

var gplay = require('google-play-scraper');

gplay.app({appId: 'com.google.android.apps.translate'})
  .then(console.log, console.log);