Method: Backup#zip

Defined in:
app/models/backup.rb

#zip(stream) ⇒ Object

TODO: Maybe investigate zipline gem a little more and figure out how it streams zips, and use that here, so this can be properly streamed.



28
29
30
31
32
33
34
35
36
37
# File 'app/models/backup.rb', line 28

def zip(stream)
  buffer = Zip::OutputStream.write_buffer do |zos|
    Backup.each do |entry|
      zos.put_next_entry entry.path
      zos.write entry.content
    end
  end

  stream.write buffer.string
end