title: Images are not getting downloaded using promises
body: <p>I need to download all images and generate word document with them.
  Using nodeJS and Meteor</p>
  <pre class="lang-js prettyprint-override"><code>WebApp.connectHandlers.use('/download', async function (req, res, next) {
    // ...
  
    const images = [];
  
    await lines.forEach(async (line, k) =&gt; {
      if (line.type &amp;&amp; line.type === 'image') {
        images.push({
          id: line.id,
          file: line.id + '.jpg',
        });
  
        download_image(line.imageUrl, line.id + '.jpg');
      }
    });
  
    // ...
  
    // Then I use images[] to insert them into a Word document.
  });
  
  const download_image = (url, image_path) =&gt;
    axios({
      url,
      responseType: 'stream',
    }).then(
      (response) =&gt;
        new Promise((resolve, reject) =&gt; {
          response.data
            .pipe(fs.createWriteStream(image_path))
            .on('finish', () =&gt; resolve())
            .on('error', (e) =&gt; reject(e));
        })
    );
  </code></pre>
  <p>The problem is images are not getting downloaded before I insert the into a Word document.</p>
  <p>How to stop/await before images are finished to be downloaded? I am not so good with promises. What is missing her?</p>
  <p>Thanks!</p>