lib/optimize.js
function writeOptimizedImages(imageData) {
  return Promise.all(
    imageData.map(item =>
      pify(fs.writeFile)(item.path, item.data).then(() => item.path)
    )
  );
}
function writeOptimizedImages(imageData) {
  return Promise.all(
    imageData.map(item =>
      pify(fs.writeFile)(item.path, item.data).then(() => item.path)
    )
  );
}
function writeOptimizedImages ( imageData ) { return Promise . all ( imageData . map ( item => pify ( fs . writeFile ) ( item . path , item . data ) . then ( ( ) => item . path ) ) ) ; }
Given output from imagemin, write image files.

@param {Array<{ path: string, data: Buffer }>} imageData - imagemin output.
@return {Promise<Array<string>>} - Resolves with an array of filenames for optimized images that
have been written.
Given output from imagemin write image files .