{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/1422","labels_url":"https://api.github.com/repos/manastech/crystal/issues/1422/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/1422/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/1422/events","html_url":"https://github.com/manastech/crystal/issues/1422","id":105518683,"number":1422,"title":"POC: Zip Archive Library","user":{"login":"jwaldrip","id":43164,"avatar_url":"https://avatars.githubusercontent.com/u/43164?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaldrip","html_url":"https://github.com/jwaldrip","followers_url":"https://api.github.com/users/jwaldrip/followers","following_url":"https://api.github.com/users/jwaldrip/following{/other_user}","gists_url":"https://api.github.com/users/jwaldrip/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaldrip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaldrip/subscriptions","organizations_url":"https://api.github.com/users/jwaldrip/orgs","repos_url":"https://api.github.com/users/jwaldrip/repos","events_url":"https://api.github.com/users/jwaldrip/events{/privacy}","received_events_url":"https://api.github.com/users/jwaldrip/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/manastech/crystal/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/manastech/crystal/labels/RFC","name":"RFC","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2015-09-09T04:55:39Z","updated_at":"2015-09-11T14:05:15Z","closed_at":null,"body":"I would like to start by contributing an archive library. What does everyone think of the following DSL?\r\n\r\n```crystal\r\nArchive::Zip.open(\"foo.zip\") do |zip|\r\n  # Set File\r\n  zip.write(\"sample.txt\", \"contents\")\r\n\r\n  # or maybe also ...\r\n  zip[\"sample.txt\"] = \"contents\"\r\n\r\n  # Set File with Permissions\r\n  zip.write(\"sample.txt\", \"contents\", 0755)\r\n\r\n  # Set File from IO\r\n  zip.write(\"sample-2.txt\", File.open \"sample.txt\")\r\n\r\n  # Add file to zip, as is with the current name\r\n  zip << File.open(\"sample-3.txt\")\r\n\r\n  # Shorthand of above\r\n  zip << \"sample-3.txt\"\r\n\r\n  # Change directory\r\n  zip.dir \"foo\" do |dir|\r\n    # Adds a file at the directory\r\n    dir << File.open(\"sample-3.txt\")\r\n  end\r\n\r\n  # Read all files from a zip\r\n  zip.each do |file|\r\n    puts file.name\r\n    puts file.read\r\n  end\r\n\r\n  # Get filenames\r\n  puts zip.list_files\r\n\r\n  # Get file by name\r\n  puts zip.read(\"sample.txt\")\r\n\r\n  # change directories and list files\r\n  zip.dir \"foo\" do |dir|\r\n    puts dir.list_files\r\n  end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/139556061","html_url":"https://github.com/manastech/crystal/issues/1422#issuecomment-139556061","issue_url":"https://api.github.com/repos/manastech/crystal/issues/1422","id":139556061,"user":{"login":"kirbyfan64","id":1690697,"avatar_url":"https://avatars.githubusercontent.com/u/1690697?v=3","gravatar_id":"","url":"https://api.github.com/users/kirbyfan64","html_url":"https://github.com/kirbyfan64","followers_url":"https://api.github.com/users/kirbyfan64/followers","following_url":"https://api.github.com/users/kirbyfan64/following{/other_user}","gists_url":"https://api.github.com/users/kirbyfan64/gists{/gist_id}","starred_url":"https://api.github.com/users/kirbyfan64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirbyfan64/subscriptions","organizations_url":"https://api.github.com/users/kirbyfan64/orgs","repos_url":"https://api.github.com/users/kirbyfan64/repos","events_url":"https://api.github.com/users/kirbyfan64/events{/privacy}","received_events_url":"https://api.github.com/users/kirbyfan64/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T14:05:15Z","updated_at":"2015-09-11T14:05:15Z","body":"@Nakilon Why not?"}}