{"action":"created","comment":{"url":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/comments/85643807","pull_request_review_id":6350479,"id":85643807,"diff_hunk":"@@ -203,6 +210,41 @@ withEntry inner = do\n             Just (ChunkException e) -> throwM e\n             Nothing -> return ()\n \n+{-| This function handles each entry of the tar archive according to the\n+behaviour of the function passed as first argument.\n+\n+Here is a full example function, that read a compressed tar archive and for each entry that is a simple file, it returns its file path and SHA256 digest. Note that function can throw exceptions!\n+\n+> import qualified Crypto.Hash.Conduit as CH\n+> import qualified Data.Conduit.Tar    as CT\n+> \n+> import Conduit\n+> import Crypto.Hash (Digest, SHA256)\n+> import Control.Monad (when)\n+> import Data.Conduit.Zlib (ungzip)\n+> import Data.ByteString (ByteString)\n+> \n+> filedigests :: FilePath -> IO [(FilePath, Digest SHA256)]\n+> filedigests fp = runConduitRes (  sourceFileBS fp          -- read the raw file\n+>                                .| ungzip                   -- gunzip\n+>                                .| CT.untar                 -- decode the tar archive\n+>                                .| CT.withEntries hashentry -- process each file\n+>                                .| sinkList                 -- collect the results\n+>                                )\n+>     where\n+>         hashentry hdr = when (CT.headerFileType hdr == CT.FTNormal) $ do\n+>             hash <- CH.sinkHash\n+>             yield (CT.headerFilePath hdr, hash)\n+\n+The @hashentry@ function handles on a single entry, based on its first 'Header' argument.\n+In this example, a 'Consumer' is used to process the whole entry.\n+\n+Note that the benefits of stream processing are easily lost when working with a 'Consumer'. For example, the following implementation can use an unbounded amount of memory:","path":"src/Data/Conduit/Tar.hs","position":144,"original_position":144,"commit_id":"3a3ad734676b5f511a9929ce726aebe3c1bfa136","original_commit_id":"3a3ad734676b5f511a9929ce726aebe3c1bfa136","user":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"body":"Very nice :)","created_at":"2016-10-29T16:48:19Z","updated_at":"2016-10-29T16:49:42Z","html_url":"https://github.com/snoyberg/tar-conduit/pull/3#discussion_r85643807","pull_request_url":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/comments/85643807"},"html":{"href":"https://github.com/snoyberg/tar-conduit/pull/3#discussion_r85643807"},"pull_request":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3","id":91371323,"html_url":"https://github.com/snoyberg/tar-conduit/pull/3","diff_url":"https://github.com/snoyberg/tar-conduit/pull/3.diff","patch_url":"https://github.com/snoyberg/tar-conduit/pull/3.patch","issue_url":"https://api.github.com/repos/snoyberg/tar-conduit/issues/3","number":3,"state":"open","locked":false,"title":"Documenting the module a bit.","user":{"login":"bartavelle","id":1183983,"avatar_url":"https://avatars.githubusercontent.com/u/1183983?v=3","gravatar_id":"","url":"https://api.github.com/users/bartavelle","html_url":"https://github.com/bartavelle","followers_url":"https://api.github.com/users/bartavelle/followers","following_url":"https://api.github.com/users/bartavelle/following{/other_user}","gists_url":"https://api.github.com/users/bartavelle/gists{/gist_id}","starred_url":"https://api.github.com/users/bartavelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartavelle/subscriptions","organizations_url":"https://api.github.com/users/bartavelle/orgs","repos_url":"https://api.github.com/users/bartavelle/repos","events_url":"https://api.github.com/users/bartavelle/events{/privacy}","received_events_url":"https://api.github.com/users/bartavelle/received_events","type":"User","site_admin":false},"body":"I tried documenting the module a little bit, including an usage example.\r\n\r\nI also tried highlighting the bad practice of collecting all file content before processing it.\r\n\r\nDo you have suggestions about the content of this commit ? I will start publishing the package as soon as this is merged.","created_at":"2016-10-28T12:16:04Z","updated_at":"2016-10-29T16:49:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c04836d78c72b19819f6e972ee5026aa2c9e4b9f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3/commits","review_comments_url":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3/comments","review_comment_url":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snoyberg/tar-conduit/issues/3/comments","statuses_url":"https://api.github.com/repos/snoyberg/tar-conduit/statuses/3a3ad734676b5f511a9929ce726aebe3c1bfa136","head":{"label":"bartavelle:master","ref":"master","sha":"3a3ad734676b5f511a9929ce726aebe3c1bfa136","user":{"login":"bartavelle","id":1183983,"avatar_url":"https://avatars.githubusercontent.com/u/1183983?v=3","gravatar_id":"","url":"https://api.github.com/users/bartavelle","html_url":"https://github.com/bartavelle","followers_url":"https://api.github.com/users/bartavelle/followers","following_url":"https://api.github.com/users/bartavelle/following{/other_user}","gists_url":"https://api.github.com/users/bartavelle/gists{/gist_id}","starred_url":"https://api.github.com/users/bartavelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartavelle/subscriptions","organizations_url":"https://api.github.com/users/bartavelle/orgs","repos_url":"https://api.github.com/users/bartavelle/repos","events_url":"https://api.github.com/users/bartavelle/events{/privacy}","received_events_url":"https://api.github.com/users/bartavelle/received_events","type":"User","site_admin":false},"repo":{"id":72196240,"name":"tar-conduit","full_name":"bartavelle/tar-conduit","owner":{"login":"bartavelle","id":1183983,"avatar_url":"https://avatars.githubusercontent.com/u/1183983?v=3","gravatar_id":"","url":"https://api.github.com/users/bartavelle","html_url":"https://github.com/bartavelle","followers_url":"https://api.github.com/users/bartavelle/followers","following_url":"https://api.github.com/users/bartavelle/following{/other_user}","gists_url":"https://api.github.com/users/bartavelle/gists{/gist_id}","starred_url":"https://api.github.com/users/bartavelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartavelle/subscriptions","organizations_url":"https://api.github.com/users/bartavelle/orgs","repos_url":"https://api.github.com/users/bartavelle/repos","events_url":"https://api.github.com/users/bartavelle/events{/privacy}","received_events_url":"https://api.github.com/users/bartavelle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bartavelle/tar-conduit","description":"Conduit based tar extraction mechanism","fork":true,"url":"https://api.github.com/repos/bartavelle/tar-conduit","forks_url":"https://api.github.com/repos/bartavelle/tar-conduit/forks","keys_url":"https://api.github.com/repos/bartavelle/tar-conduit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bartavelle/tar-conduit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bartavelle/tar-conduit/teams","hooks_url":"https://api.github.com/repos/bartavelle/tar-conduit/hooks","issue_events_url":"https://api.github.com/repos/bartavelle/tar-conduit/issues/events{/number}","events_url":"https://api.github.com/repos/bartavelle/tar-conduit/events","assignees_url":"https://api.github.com/repos/bartavelle/tar-conduit/assignees{/user}","branches_url":"https://api.github.com/repos/bartavelle/tar-conduit/branches{/branch}","tags_url":"https://api.github.com/repos/bartavelle/tar-conduit/tags","blobs_url":"https://api.github.com/repos/bartavelle/tar-conduit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bartavelle/tar-conduit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bartavelle/tar-conduit/git/refs{/sha}","trees_url":"https://api.github.com/repos/bartavelle/tar-conduit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bartavelle/tar-conduit/statuses/{sha}","languages_url":"https://api.github.com/repos/bartavelle/tar-conduit/languages","stargazers_url":"https://api.github.com/repos/bartavelle/tar-conduit/stargazers","contributors_url":"https://api.github.com/repos/bartavelle/tar-conduit/contributors","subscribers_url":"https://api.github.com/repos/bartavelle/tar-conduit/subscribers","subscription_url":"https://api.github.com/repos/bartavelle/tar-conduit/subscription","commits_url":"https://api.github.com/repos/bartavelle/tar-conduit/commits{/sha}","git_commits_url":"https://api.github.com/repos/bartavelle/tar-conduit/git/commits{/sha}","comments_url":"https://api.github.com/repos/bartavelle/tar-conduit/comments{/number}","issue_comment_url":"https://api.github.com/repos/bartavelle/tar-conduit/issues/comments{/number}","contents_url":"https://api.github.com/repos/bartavelle/tar-conduit/contents/{+path}","compare_url":"https://api.github.com/repos/bartavelle/tar-conduit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bartavelle/tar-conduit/merges","archive_url":"https://api.github.com/repos/bartavelle/tar-conduit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bartavelle/tar-conduit/downloads","issues_url":"https://api.github.com/repos/bartavelle/tar-conduit/issues{/number}","pulls_url":"https://api.github.com/repos/bartavelle/tar-conduit/pulls{/number}","milestones_url":"https://api.github.com/repos/bartavelle/tar-conduit/milestones{/number}","notifications_url":"https://api.github.com/repos/bartavelle/tar-conduit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bartavelle/tar-conduit/labels{/name}","releases_url":"https://api.github.com/repos/bartavelle/tar-conduit/releases{/id}","deployments_url":"https://api.github.com/repos/bartavelle/tar-conduit/deployments","created_at":"2016-10-28T09:58:17Z","updated_at":"2016-10-28T09:58:18Z","pushed_at":"2016-10-28T12:13:28Z","git_url":"git://github.com/bartavelle/tar-conduit.git","ssh_url":"git@github.com:bartavelle/tar-conduit.git","clone_url":"https://github.com/bartavelle/tar-conduit.git","svn_url":"https://github.com/bartavelle/tar-conduit","homepage":"","size":7,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"snoyberg:master","ref":"master","sha":"a3c996394d9eef532c3ca0844f165eadca82ac38","user":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"repo":{"id":14566587,"name":"tar-conduit","full_name":"snoyberg/tar-conduit","owner":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/snoyberg/tar-conduit","description":"Conduit based tar extraction mechanism","fork":false,"url":"https://api.github.com/repos/snoyberg/tar-conduit","forks_url":"https://api.github.com/repos/snoyberg/tar-conduit/forks","keys_url":"https://api.github.com/repos/snoyberg/tar-conduit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snoyberg/tar-conduit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snoyberg/tar-conduit/teams","hooks_url":"https://api.github.com/repos/snoyberg/tar-conduit/hooks","issue_events_url":"https://api.github.com/repos/snoyberg/tar-conduit/issues/events{/number}","events_url":"https://api.github.com/repos/snoyberg/tar-conduit/events","assignees_url":"https://api.github.com/repos/snoyberg/tar-conduit/assignees{/user}","branches_url":"https://api.github.com/repos/snoyberg/tar-conduit/branches{/branch}","tags_url":"https://api.github.com/repos/snoyberg/tar-conduit/tags","blobs_url":"https://api.github.com/repos/snoyberg/tar-conduit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snoyberg/tar-conduit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snoyberg/tar-conduit/git/refs{/sha}","trees_url":"https://api.github.com/repos/snoyberg/tar-conduit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snoyberg/tar-conduit/statuses/{sha}","languages_url":"https://api.github.com/repos/snoyberg/tar-conduit/languages","stargazers_url":"https://api.github.com/repos/snoyberg/tar-conduit/stargazers","contributors_url":"https://api.github.com/repos/snoyberg/tar-conduit/contributors","subscribers_url":"https://api.github.com/repos/snoyberg/tar-conduit/subscribers","subscription_url":"https://api.github.com/repos/snoyberg/tar-conduit/subscription","commits_url":"https://api.github.com/repos/snoyberg/tar-conduit/commits{/sha}","git_commits_url":"https://api.github.com/repos/snoyberg/tar-conduit/git/commits{/sha}","comments_url":"https://api.github.com/repos/snoyberg/tar-conduit/comments{/number}","issue_comment_url":"https://api.github.com/repos/snoyberg/tar-conduit/issues/comments{/number}","contents_url":"https://api.github.com/repos/snoyberg/tar-conduit/contents/{+path}","compare_url":"https://api.github.com/repos/snoyberg/tar-conduit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snoyberg/tar-conduit/merges","archive_url":"https://api.github.com/repos/snoyberg/tar-conduit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snoyberg/tar-conduit/downloads","issues_url":"https://api.github.com/repos/snoyberg/tar-conduit/issues{/number}","pulls_url":"https://api.github.com/repos/snoyberg/tar-conduit/pulls{/number}","milestones_url":"https://api.github.com/repos/snoyberg/tar-conduit/milestones{/number}","notifications_url":"https://api.github.com/repos/snoyberg/tar-conduit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snoyberg/tar-conduit/labels{/name}","releases_url":"https://api.github.com/repos/snoyberg/tar-conduit/releases{/id}","deployments_url":"https://api.github.com/repos/snoyberg/tar-conduit/deployments","created_at":"2013-11-20T19:25:51Z","updated_at":"2016-10-27T17:27:38Z","pushed_at":"2016-10-28T12:16:04Z","git_url":"git://github.com/snoyberg/tar-conduit.git","ssh_url":"git@github.com:snoyberg/tar-conduit.git","clone_url":"https://github.com/snoyberg/tar-conduit.git","svn_url":"https://github.com/snoyberg/tar-conduit","homepage":"","size":5,"stargazers_count":2,"watchers_count":2,"language":"Haskell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3"},"html":{"href":"https://github.com/snoyberg/tar-conduit/pull/3"},"issue":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/issues/3"},"comments":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/snoyberg/tar-conduit/statuses/3a3ad734676b5f511a9929ce726aebe3c1bfa136"}}}}
{"actor":{"display_login":"snoyberg"}}