index.js
function copyToTemp () {
    fs.readFile(inPath, function (err, inFile) {
      if (err) return cb(err)
      var tmpPath = path.join(os.tmpdir(), 'cross-zip-' + Date.now())
      fs.mkdir(tmpPath, function (err) {
        if (err) return cb(err)
        fs.writeFile(path.join(tmpPath, path.basename(inPath)), inFile, function (err) {
          if (err) return cb(err)
          inPath = tmpPath
          doZip()
        })
      })
    })
  }
function copyToTemp () {
    fs.readFile(inPath, function (err, inFile) {
      if (err) return cb(err)
      var tmpPath = path.join(os.tmpdir(), 'cross-zip-' + Date.now())
      fs.mkdir(tmpPath, function (err) {
        if (err) return cb(err)
        fs.writeFile(path.join(tmpPath, path.basename(inPath)), inFile, function (err) {
          if (err) return cb(err)
          inPath = tmpPath
          doZip()
        })
      })
    })
  }
function copyToTemp ( ) { fs . readFile ( inPath , function ( err , inFile ) { if ( err ) return cb ( err ) var tmpPath = path . join ( os . tmpdir ( ) , 'cross-zip-' + Date . now ( ) ) fs . mkdir ( tmpPath , function ( err ) { if ( err ) return cb ( err ) fs . writeFile ( path . join ( tmpPath , path . basename ( inPath ) ) , inFile , function ( err ) { if ( err ) return cb ( err ) inPath = tmpPath doZip ( ) } ) } ) } ) }
Windows zip command cannot zip files, only directories. So move the file into a temporary directory before zipping.
Windows zip command cannot zip files only directories . So move the file into a temporary directory before zipping .