How to rewrite this async code into promise?

all the examples of using puppeter to generate pdf, official documents are written in async,await, but the node version of the project is 6.6, and async is not supported. How to change the following code to promise??

const puppeteer = require("puppeteer");
 
(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto("http://www.baidu.com", {waitUntil: "networkidle2"});
  await page.pdf({
      path: "hn.pdf", 
      format: "A4"
    });
 
  await browser.close();
})();

const puppeteer = require('puppeteer');

(() => {
  puppeteer.launch().then(browser => {
    browser.newPage().then(page => {
      page.goto('http://www.baidu.com', {waitUntil: 'networkidle2'}).then(() => {
        page.pdf({
          path: 'hn.pdf',
          format: 'A4',
        }).then(() => {
          browser.close();
        });
      });
    });
  });
})();

can you try to run it? this is probably the way of thinking. Change await to Promise call

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be8627-31147.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be8627-31147.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?