src/steps/step-album-zip.js
function createZip (targetZipPath, currentFolder, filesToInclude, done) {
  const args = ['-FS', targetZipPath].concat(filesToInclude)
  const startTime = Date.now()
  trace(`Calling: zip ${args.join(' ')}`)
  const child = childProcess.spawn('zip', args, {
    cwd: currentFolder,
    stdio: [ 'ignore', 'ignore', 'ignore' ]
  })
  child.on('error', (err) => {
    error(`Error: please verify that <zip> is installed on your system`)
    error(err.toString())
  })
  child.on('close', (code, signal) => {
    const elapsed = Math.floor(Date.now() - startTime)
    debug(`Zip exited with code ${code} in ${elapsed}ms`)
    done(code === 0 ? null : new Error(`Error creating ZIP file ${targetZipPath}`))
  })
}
function createZip (targetZipPath, currentFolder, filesToInclude, done) {
  const args = ['-FS', targetZipPath].concat(filesToInclude)
  const startTime = Date.now()
  trace(`Calling: zip ${args.join(' ')}`)
  const child = childProcess.spawn('zip', args, {
    cwd: currentFolder,
    stdio: [ 'ignore', 'ignore', 'ignore' ]
  })
  child.on('error', (err) => {
    error(`Error: please verify that <zip> is installed on your system`)
    error(err.toString())
  })
  child.on('close', (code, signal) => {
    const elapsed = Math.floor(Date.now() - startTime)
    debug(`Zip exited with code ${code} in ${elapsed}ms`)
    done(code === 0 ? null : new Error(`Error creating ZIP file ${targetZipPath}`))
  })
}
function createZip ( targetZipPath , currentFolder , filesToInclude , done ) { const args = [ '-FS' , targetZipPath ] . concat ( filesToInclude ) const startTime = Date . now ( ) trace ( ` ${ args . join ( ' ' ) } ` ) const child = childProcess . spawn ( 'zip' , args , { cwd : currentFolder , stdio : [ 'ignore' , 'ignore' , 'ignore' ] } ) child . on ( 'error' , ( err ) => { error ( ` ` ) error ( err . toString ( ) ) } ) child . on ( 'close' , ( code , signal ) => { const elapsed = Math . floor ( Date . now ( ) - startTime ) debug ( ` ${ code } ${ elapsed } ` ) done ( code === 0 ? null : new Error ( ` ${ targetZipPath } ` ) ) } ) }
This function uses the Unix ZIP command, which supports "updating" a ZIP file In the future it could also delegate to 7zip on Windows
This function uses the Unix ZIP command which supports updating a ZIP file In the future it could also delegate to 7zip on Windows