app/controllers/concerns/show_dip.rb
# given a dataset, generate an in-memory zip file of the dataset's dip files (with the correct directory structure)
# and return the zip filestream (so that it can be written to user's browser as a zip file in the controller)
given a dataset, generate an in-memory zip file of the dataset's dip files (with the correct directory structure)
and return the zip filestream (so that it can be written to user's browser as a zip file in the controller)
given a dataset generate an in - memory zip file of the dataset ' s dip files ( with the correct directory structure ) and return the zip filestream ( so that it can be written to user ' s browser as a zip file in the controller )
def dip_as_zip_filestream(dataset)
    dip_structure = dip_directory_structure(dataset)
    ::Zip.sort_entries = true
    file_stream = Zip::OutputStream.write_buffer do |zip|
      dip_structure.each do |_file_id, file_details|
        file = open(file_details[:file_uri], &:read)
        zip.put_next_entry(file_details[:file_path])
        zip.write(file)
      end
    end
    file_stream.rewind
    file_stream
  end
def dip_as_zip_filestream ( dataset ) dip_structure = dip_directory_structure ( dataset ) :: Zip . sort_entries = true file_stream = Zip :: OutputStream . write_buffer do | zip | dip_structure . each do | _file_id , file_details | file = open ( file_details [ :file_uri ] , & :read ) zip . put_next_entry ( file_details [ :file_path ] ) zip . write ( file ) end end file_stream . rewind file_stream end
given a dataset, generate an in-memory zip file of the dataset's dip files (with the correct directory structure)
and return the zip filestream (so that it can be written to user's browser as a zip file in the controller)
given a dataset generate an in - memory zip file of the dataset ' s dip files ( with the correct directory structure ) and return the zip filestream ( so that it can be written to user ' s browser as a zip file in the controller )
# first of all, get the structure of the dip files # set up a new zip file in-memory with files sorted alphabetically # for each file in the dip # get the contents of the file # create this file in the zip
dataset
<not_specific>