lib/zipTree.js
function zipFile(zip, zipPath, bufferPromise, fileOpts) {
  return bufferPromise
    .then(buffer =>
      zip.file(
        zipPath,
        buffer,
        Object.assign(
          {},
          {
            // necessary to get the same hash when zipping the same content
            date: new Date(0)
          },
          fileOpts
        )
      )
    )
    .then(() => zip);
}
function zipFile(zip, zipPath, bufferPromise, fileOpts) {
  return bufferPromise
    .then(buffer =>
      zip.file(
        zipPath,
        buffer,
        Object.assign(
          {},
          {
            // necessary to get the same hash when zipping the same content
            date: new Date(0)
          },
          fileOpts
        )
      )
    )
    .then(() => zip);
}
function zipFile ( zip , zipPath , bufferPromise , fileOpts ) { return bufferPromise . then ( buffer => zip . file ( zipPath , buffer , Object . assign ( { } , { // necessary to get the same hash when zipping the same content date : new Date ( 0 ) } , fileOpts ) ) ) . then ( ( ) => zip ) ; }
Add a new file to a zip file from a buffer.
@param {JSZip} zip the zip object to add the file to.
@param {string} zipPath the target path in the zip.
@param {Promise} bufferPromise a promise providing a nodebuffer.
@return {Promise} a promise providing the JSZip object.
@param {object} fileOpts an object with the opts to save for the file in the zip.
Add a new file to a zip file from a buffer .