Skip to content

Instantly share code, notes, and snippets.

@olivermt olivermt/code.ex
Created Mar 2, 2017

Embed
What would you like to do?
zip_files = Enum.map(files, fn %{"id" => id, "name" => name} ->
Path.join(dest_dir, "#{id}-#{name}")
end)
|> Enum.map(&String.to_char_list/1)
zip_target = Path.join(dest_dir, "bundle.zip") |> String.to_char_list
Logger.debug "Zipping files #{inspect zip_files} to #{inspect zip_target}"
zip_ret = :zip.create(zip_target, files, [:memory])
Logger.debug "Zip return: #{inspect zip_ret}"
[debug] module=Sow.OSPApplicationExportService function=files/2 Stored some files at C:\Users\oliver\AppData\Local\Temp/b0b6a6ed-7c28-494a-9505-820cf2eee1db
[debug] module=Sow.OSPApplicationExportService function=files/2 Zipping files ['C:\\Users\\oliver\\AppData\\Local\\Temp/b0b6a6ed-7c28-494a-9505-820cf2eee1db/2-cutedog.jpg'] to 'C:\\Users\\oliver\\AppData\\Local\\Temp/b0b6a6ed-7c28-494a-9505-820cf2eee1db/bundle.zip'
[debug] module=Sow.OSPApplicationExportService function=files/2 Zip return: {:error, :einval}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.