async zipFiles(files, zipFileName, prefix) {
    if (files.length === 0) {
      const error = new ServerlessError(
        'No files to package',
        'NO_FILES_TO_PACKAGE',
      )
      return Promise.reject(error)
    }

    const zip = archiver.create('zip')
    // Create artifact in temp path and move it to the package path (if any) later
    const artifactFilePath = path.join(
      this.serverless.serviceDir,
      '.serverless',
      zipFileName,
    )
    this.serverless.utils.writeFileDir(artifactFilePath)
    const output = createWriteStream(artifactFilePath)

    return new Promise((resolve, reject) => {
      output.on('close', () => resolve(artifactFilePath))
      output.on('error', (err) => reject(err))
      zip.on('error', (err) => reject(err))

      output.on('open', () => {
        zip.pipe(output)

        // normalize both maps to avoid problems with e.g. Path Separators in different shells
        const normalizedFiles = _.uniq(
          files.map((file) => path.normalize(file)),
        )

        return pMap(normalizedFiles, this.getFileContentAndStat.bind(this), {
          concurrency: os.cpus().length,
        })
          .then((contents) => {
            contents
              .sort((content1, content2) =>
                content1.filePath.localeCompare(content2.filePath),
              )
              .forEach((file) => {
                const name = file.filePath.slice(
                  prefix ? `${prefix}${path.sep}`.length : 0,
                )
                // Ensure file is executable if it is locally executable or
                // we force it to be executable if platform is windows
                const mode =
                  file.stat.mode & 0o100 || process.platform === 'win32'
                    ? 0o755
                    : 0o644
                zip.append(file.data, {
                  name,
                  mode,
                  date: new Date(0), // necessary to get the same hash when zipping the same content
                })
              })

            zip.finalize()
          })
          .catch(reject)
      })
    })
  }
Create a zip file on disk from an array of filenames of files on disk
@param files - an Array of filenames
@param zipFiles - the filename to save the zip at
@param prefix - a prefix to strip from the file names. use for layers support