title: Saving a file without document directory ios
body: <p>hope you are doing good in development. I have a question regarding Zipping currently i am using Zip framework which I am using for zip the all captured image in device but the problem here is I do not want to save the Zip file in document directory instead I wanna save this memory itself. I am struggling since last week please let me know how can we achieve the zipping without saving it in local directory filepath</p>
  
  <p>Also when I captured the image successfully I saved it to local directory using </p>
  
  <pre><code>let documentsDirectory = FileManager.default.urls(for:
  .documentDirectory, in: .userDomainMask).first!
  
  let fileName = "image.jpg"
  
  let fileURL = documentsDirectory.appendingPathComponent(fileName)
  
  if let data = UIImageJPEGRepresentation(image, 1.0),
    !FileManager.default.fileExists(atPath: fileURL.path) {
      do {
          // writes the image data to disk
          try data.write(to: fileURL)
          print("file saved")
      } catch {
          print("error saving file:", error)
      }
  }
  </code></pre>
  
  <p>After when I am trying to send the image before our server I want to make it all one file so I have implemented the Zip (framework)
  Here filpathArray meant all captured image in local path</p>
  
  <pre><code>do {
      var urls = [URL]()
  
      for i in 0..&lt;(self.filePathArray.count)
      {
          urls.append(self.filePathArray[i] as! URL)
      }
  
      if self.filePathArray.count &gt; 0 {
          let zipFiles = try Zip.quickZipFiles(urls, fileName: "AllFiles")
      }
  }
  </code></pre>
  
  <p>Here zipping is done successfully but it saved in local path so when using app container I can able to see the images, I do not want to see the images in device like apple sandbox or Xcode container itself </p>
  
  <p>I want to make zipping on the flow like without saving it document directory, Thanks in advance.</p>